diff options
| author | Sergey M․ <dstftw@gmail.com> | 2015-11-20 03:08:34 +0600 | 
|---|---|---|
| committer | Sergey M․ <dstftw@gmail.com> | 2015-11-23 21:55:13 +0600 | 
| commit | 82d8a8b6e2eadb2c1ac8684ce9876f40925f4e2e (patch) | |
| tree | cc27df52b723c4a7f36034aea66f8b8847f50337 | |
| parent | 13a10d5aa336be7c301a6d09eb4e9d7b50f51191 (diff) | |
[YoutubeDL] Wrap plain-text URL requests in compat_urllib_request_Request
| -rwxr-xr-x | youtube_dl/YoutubeDL.py | 4 | 
1 files changed, 4 insertions, 0 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index fba99af8d..b20837ce2 100755 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -28,6 +28,7 @@ if os.name == 'nt':      import ctypes  from .compat import ( +    compat_basestring,      compat_cookiejar,      compat_expanduser,      compat_get_terminal_size, @@ -38,6 +39,7 @@ from .compat import (      compat_urllib_error,      compat_urllib_request,      compat_urllib_request_DataHandler, +    compat_urllib_request_Request,  )  from .utils import (      ContentTooShortError, @@ -1871,6 +1873,8 @@ class YoutubeDL(object):      def urlopen(self, req):          """ Start an HTTP download """ +        if isinstance(req, compat_basestring): +            req = compat_urllib_request_Request(req)          return self._opener.open(req, timeout=self._socket_timeout)      def print_debug_header(self):  | 
