mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-18 00:05:22 +01:00
[YoutubeDL] Wrap plain-text URL requests in compat_urllib_request_Request
This commit is contained in:
parent
13a10d5aa3
commit
82d8a8b6e2
|
@ -28,6 +28,7 @@
|
|||
import ctypes
|
||||
|
||||
from .compat import (
|
||||
compat_basestring,
|
||||
compat_cookiejar,
|
||||
compat_expanduser,
|
||||
compat_get_terminal_size,
|
||||
|
@ -38,6 +39,7 @@
|
|||
compat_urllib_error,
|
||||
compat_urllib_request,
|
||||
compat_urllib_request_DataHandler,
|
||||
compat_urllib_request_Request,
|
||||
)
|
||||
from .utils import (
|
||||
ContentTooShortError,
|
||||
|
@ -1871,6 +1873,8 @@ def list_subtitles(self, video_id, subtitles, name='subtitles'):
|
|||
|
||||
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):
|
||||
|
|
Loading…
Reference in New Issue
Block a user