Tuesday, March 18, 2014

youtube-dl - Python on Windows - routines:SSL23_GET_SERVER_HELLO:unknown protocol

A helpful tip for those using youtube-dl on Windows.

I setup my dads computer so that he could put youtube url's into a text file, then click on a simple batch script to have them download with youtube-dl.

System: Windows 7 64bit
Python: v2.7.2

He became unable to download videos over the past couple months- every video giving an error. I figured it would go away after a bit with a new update came out, but it never did. Here is the type of error output that would display:


youtube-dl -vv http://www.youtube.com/watch?v=AOBCWukvZ8o

[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-vv', 'http://www.youtube.com/watch?v=AOBCWukvZ8o']
[debug] Encodings: locale 'cp1252', fs 'mbcs', out None, pref: 'cp1252'
[debug] youtube-dl version 2014.03.18.1
[debug] Python version 2.7.2 - Windows-7-6.1.7601-SP1
[debug] Proxy map: {}
[youtube] Setting language
WARNING: unable to set language: <urlopen error [Errno 1] _ssl.c:503: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol>
[youtube] AOBCWukvZ8o: Downloading webpage
ERROR: Unable to download webpage: <urlopen error [Errno 1] _ssl.c:503: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol>
  File "youtube-dl\youtube_dl\extractor\common.py", line 194, in _request_webpage
    return self._downloader.urlopen(url_or_request)
  File "youtube-dl\youtube_dl\YoutubeDL.py", line 1191, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "C:\Program Files\Python27\lib\urllib2.py", line 394, in open
    response = self._open(req, data)
  File "C:\Program Files\Python27\lib\urllib2.py", line 412, in _open
    '_open', req)
  File "C:\Program Files\Python27\lib\urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "youtube-dl\youtube_dl\utils.py", line 580, in https_open
    return self.do_open(HTTPSConnectionV3, req)
  File "C:\Program Files\Python27\lib\urllib2.py", line 1174, in do_open
    raise URLError(err)


This is a bug noted in report #2219.



Solution:
Upgrade Python from 2.7.2 to the latest Python 2.7.6.



Batch Script:

rem Batch Script: yt-downloader.bat
rem Try to automatically upgrade youtube-dl on each run.
"C:\Python27\python.exe" "C:\youtube-dl\youtube-dl" -U
rem For highest quality downloads, remove "-f 18 " on next line.
"C:\Python27\python.exe" "C:\youtube-dl\youtube-dl"-itcR 100 -f 18 --no-mtime --no-part -a "C:\Users\User\Desktop\videos\download list.txt"




In the script, you cann see to save urls that you want to download in the file "Desktop\videos\download list.txt".


No comments:

Post a Comment