mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 03:33:02 +00:00
Fix xvideo IE in Python 3
This commit is contained in:
parent
5cb9c3129b
commit
8588a86f9e
1 changed files with 6 additions and 5 deletions
|
@ -2770,13 +2770,14 @@ def _real_extract(self, url):
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
self._downloader.trouble(u'ERROR: invalid URL: %s' % url)
|
self._downloader.trouble(u'ERROR: invalid URL: %s' % url)
|
||||||
return
|
return
|
||||||
video_id = mobj.group(1).decode('utf-8')
|
video_id = mobj.group(1)
|
||||||
|
|
||||||
self.report_webpage(video_id)
|
self.report_webpage(video_id)
|
||||||
|
|
||||||
request = compat_urllib_request.Request(r'http://www.xvideos.com/video' + video_id)
|
request = compat_urllib_request.Request(r'http://www.xvideos.com/video' + video_id)
|
||||||
try:
|
try:
|
||||||
webpage = compat_urllib_request.urlopen(request).read()
|
webpage_bytes = compat_urllib_request.urlopen(request).read()
|
||||||
|
webpage = webpage_bytes.decode('utf-8', 'replace')
|
||||||
except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
|
except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
|
||||||
self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % compat_str(err))
|
self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % compat_str(err))
|
||||||
return
|
return
|
||||||
|
@ -2789,7 +2790,7 @@ def _real_extract(self, url):
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
self._downloader.trouble(u'ERROR: unable to extract video url')
|
self._downloader.trouble(u'ERROR: unable to extract video url')
|
||||||
return
|
return
|
||||||
video_url = compat_urllib_parse.unquote(mobj.group(1).decode('utf-8'))
|
video_url = compat_urllib_parse.unquote(mobj.group(1))
|
||||||
|
|
||||||
|
|
||||||
# Extract title
|
# Extract title
|
||||||
|
@ -2797,7 +2798,7 @@ def _real_extract(self, url):
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
self._downloader.trouble(u'ERROR: unable to extract video title')
|
self._downloader.trouble(u'ERROR: unable to extract video title')
|
||||||
return
|
return
|
||||||
video_title = mobj.group(1).decode('utf-8')
|
video_title = mobj.group(1)
|
||||||
|
|
||||||
|
|
||||||
# Extract video thumbnail
|
# Extract video thumbnail
|
||||||
|
@ -2805,7 +2806,7 @@ def _real_extract(self, url):
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
self._downloader.trouble(u'ERROR: unable to extract video thumbnail')
|
self._downloader.trouble(u'ERROR: unable to extract video thumbnail')
|
||||||
return
|
return
|
||||||
video_thumbnail = mobj.group(0).decode('utf-8')
|
video_thumbnail = mobj.group(0)
|
||||||
|
|
||||||
info = {
|
info = {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
|
Loading…
Reference in a new issue