mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-23 18:47:03 -05:00
Fix XNXX in Python 3
This commit is contained in:
parent
8f6f40d991
commit
bec102a843
@ -3424,13 +3424,14 @@ class XNXXIE(InfoExtractor):
|
|||||||
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)
|
||||||
|
|
||||||
# Get webpage content
|
# Get webpage content
|
||||||
try:
|
try:
|
||||||
webpage = compat_urllib_request.urlopen(url).read()
|
webpage_bytes = compat_urllib_request.urlopen(url).read()
|
||||||
|
webpage = webpage_bytes.decode('utf-8')
|
||||||
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' % err)
|
self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % err)
|
||||||
return
|
return
|
||||||
@ -3439,19 +3440,19 @@ class XNXXIE(InfoExtractor):
|
|||||||
if result is None:
|
if result 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(result.group(1).decode('utf-8'))
|
video_url = compat_urllib_parse.unquote(result.group(1))
|
||||||
|
|
||||||
result = re.search(self.VIDEO_TITLE_RE, webpage)
|
result = re.search(self.VIDEO_TITLE_RE, webpage)
|
||||||
if result is None:
|
if result 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 = result.group(1).decode('utf-8')
|
video_title = result.group(1)
|
||||||
|
|
||||||
result = re.search(self.VIDEO_THUMB_RE, webpage)
|
result = re.search(self.VIDEO_THUMB_RE, webpage)
|
||||||
if result is None:
|
if result 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 = result.group(1).decode('utf-8')
|
video_thumbnail = result.group(1)
|
||||||
|
|
||||||
return [{
|
return [{
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user