ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
132.72k stars 10.07k forks source link

[youtube] <urlopen error [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:598)> #3731

Open kamilregulski opened 10 years ago

kamilregulski commented 10 years ago

ERROR: unable to download video data: urlopen error [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:598)

phihag commented 10 years ago

Can you post the entire output you get when you pass in the -v option? Without that, we cannot help you.

kamilregulski commented 10 years ago

ERROR: unable to download video data: <urlopen error [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:598)> root@s1:/home/admin# youtube-dl http://www.youtube.com/watch?v=hXd9QjFYWbw [youtube] Setting language [youtube] Confirming age [youtube] hXd9QjFYWbw: Downloading webpage [youtube] hXd9QjFYWbw: Downloading video info webpage [youtube] hXd9QjFYWbw: Extracting video information ERROR: unable to download video data: <urlopen error [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:598)> root@s1:/home/admin# youtube-dl http://www.youtube.com/watch?v=hXd9QjFYWbw --verbose [debug] System config: [] [debug] User config: [] [debug] Command-line args: ['http://www.youtube.com/watch?v=hXd9QjFYWbw', '--verbose'] [debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8 [debug] youtube-dl version 2014.09.12 [debug] Python version 3.4.1 - Linux-3.2.13-grsec-xxxx-grs-ipv6-64-x86_64-with-debian-6.0.6 [debug] Proxy map: {} [youtube] Setting language [youtube] Confirming age [youtube] hXd9QjFYWbw: Downloading webpage [youtube] hXd9QjFYWbw: Downloading video info webpage [youtube] hXd9QjFYWbw: Extracting video information [debug] Invoking downloader on 'https://r1---sn-5hn7snlz.googlevideo.com/videoplayback?ipbits=0&requiressl=yes&initcwndbps=2499000&fexp=901440%2C927622%2C931983%2C932404%2C932623%2C934024%2C934030%2C946023%2C947209%2C953801%2C953901&signature=75E26A84ACECF4D15519EE33542A26575A2D1C.2DB0A1077830F118C76F11BF6F6C8352BA3FB7B5&ratebypass=yes&sparams=id%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Cmm%2Cms%2Cmv%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&sver=3&id=o-AMqREz7SCozHi9Xc2Lm8Id9zve_5Bj4Z-SjP3ufYJfoI&expire=1410536435&mm=31&upn=6x3MCKT4RH8&mt=1410514739&itag=22&key=yt5&ip=****&ms=au&source=youtube&mv=m' ERROR: unable to download video data: <urlopen error [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:598)> Traceback (most recent call last): File "/usr/local/python341/lib/python3.4/urllib/request.py", line 1189, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/usr/local/python341/lib/python3.4/http/client.py", line 1090, in request self._send_request(method, url, body, headers) File "/usr/local/python341/lib/python3.4/http/client.py", line 1128, in _send_request self.endheaders(body) File "/usr/local/python341/lib/python3.4/http/client.py", line 1086, in endheaders self._send_output(message_body) File "/usr/local/python341/lib/python3.4/http/client.py", line 924, in _send_output self.send(msg) File "/usr/local/python341/lib/python3.4/http/client.py", line 859, in send self.connect() File "/usr/local/python341/lib/python3.4/http/client.py", line 1230, in connect server_hostname=sni_hostname) File "/usr/local/python341/lib/python3.4/ssl.py", line 364, in wrap_socket _context=self) File "/usr/local/python341/lib/python3.4/ssl.py", line 578, in init self.do_handshake() File "/usr/local/python341/lib/python3.4/ssl.py", line 805, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:598)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1035, in process_info success = dl(filename, info_dict) File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1011, in dl return fd.download(name, info) File "/usr/local/bin/youtube-dl/youtube_dl/downloader/common.py", line 291, in download return self.real_download(filename, info_dict) File "/usr/local/bin/youtube-dl/youtube_dl/downloader/http.py", line 66, in real_download data = self.ydl.urlopen(request) File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1244, in urlope return self._opener.open(req, timeout=self._socket_timeout) File "/usr/local/python341/lib/python3.4/urllib/request.py", line 455, in open response = self._open(req, data) File "/usr/local/python341/lib/python3.4/urllib/request.py", line 473, in _ope '_open', req) File "/usr/local/python341/lib/python3.4/urllib/request.py", line 433, in _cal result = func(*args) File "/usr/local/python341/lib/python3.4/urllib/request.py", line 1230, in htt context=self._context, check_hostname=self._checkhostname) File "/usr/local/python341/lib/python3.4/urllib/request.py", line 1192, in do raise URLError(err) urllib.error.URLError: <urlopen error [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3

phihag commented 10 years ago

Thank you for the details. This bug is somewhat puzzling since I cannot reproduce the behavior on a number of very similar systems. Can you provide instructions on how to set up this system? How did you compile python? Does the problem occur with the debian Python as well? Can you reproduce the problem with a different ISP?

By the way, you really shouldn't be running youtube-dl as root, except to update it.

ghost commented 10 years ago

I'm experiencing the same problem on a Windows 7 box with Python 3.4.0. Console output with verbose enabled: http://pastebin.com/dSMcbg8z

Jamesc359 commented 10 years ago

I'm getting the same error as well. http://pastebin.com/c3ZvzKew

ghost commented 10 years ago

Explicitely using Python 2.7 fixed the problem for me.

AlisterH commented 10 years ago

Explicitely using Python 2.7 fixed the problem for me.

Worked for me too.

Jamesc359 commented 10 years ago

This is just a wild shot in the dark, but I suspect it's caused because Youtube doesn't like one of the ciphers Python is choosing to connect with (ADH-RC4-MD5?). I've upgraded my version of Python to 3.4.1 and I am no longer receiving the error. :-)

graudeejs commented 10 years ago

Using python 3.4.1 fixed this issue for me as well (on FreeBSD)

MikeCol commented 10 years ago

I'm getting this error, too.

Tumblr has started to deliver some elements via https.

As proposed above, I tried different python versions, but got the following errors:

python2.7

 <urlopen error [Errno 8] _ssl.c:510: EOF occurred in violation of protocol>

python3.4.0/3.4.2

<urlopen error [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:600)>

I first encountered this error when trying to download the content of an Iframe (i.e. additional html source) using self._download_webpage.

During my test I tried to simply download it using urllib.request.urlopen(...).read() (Python 3) which did work without any errors. Which in turn means that the additional code introduced by youtube-dl for secure downloads is at least partially to blame.

I tried to pinpoint it further, but I got lost... (Is there a way to single step it via PyCharm?)

gak1234 commented 9 years ago

Hello, i have this SSLV3_ALERT_HANDSHAKE_FAILURE error when running the Windows executable. Is it compiled with an old version of python or something? How can I get it to download thumbnails (soundcloud in my case)?

I tried installing Python 2.7 and 3.4 but I don't think that makes any difference with a compiled EXE.

yan12125 commented 9 years ago

@gak1234 I guess you have encountered the same problem as #5366. Yes soundcloud thumbnails is available only with Python 2.7.9 and 3.x, while the provided youtube-dl.exe is bundled with Python 2.7.8. You can try to download the whole source zip and run youtube-dl with:

python.exe youtube-dl/__main__.py

Next time please post your problem in a separate issue. It's likely that the problem is quite different for different sites. Also, remember to include the full verbose log

yan12125 commented 9 years ago

@MikeCol Could you open a new issue and paste the full verbose log? It helps us on tracking problems.

gak1234 commented 9 years ago

@yan12125 Sorry, will open a separate issue next time. I was able to work around the soundcloud thumbnail SSLv3 issue by installing Python 3.4.x and running:

pip install --upgrade youtube_dl

this command created \Scripts\youtube-dl.exe (only 90kb ?) with a python icon. That EXE has no problem with SSLv3 thumbnail soundcloud URLs!

TheNotary commented 8 years ago

I had the above problem too on Linux Mint. I installed through apt-get, but thanks to @gak1234's suggestion, I removed the apt-get version and used pip3 install --upgrade youtube_dl and things are working well again. It might be worth investigating Ubuntu/ Linux mint package version Inst youtube-dl (2014.02.17-1 Ubuntu:14.04/trusty [all]) to see if somethings broken. My inputs were youtube-dl https://www.youtube.com/watch?v=FUSTjTBA8f8 btw