mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-26 02:55:17 +00:00
Fix VimeoIE in Python 3
This commit is contained in:
parent
28ca6b5afa
commit
f1171f7c2d
1 changed files with 8 additions and 7 deletions
|
@ -1062,7 +1062,8 @@ def _real_extract(self, url, new_video=True):
|
||||||
request = compat_urllib_request.Request(url, None, std_headers)
|
request = compat_urllib_request.Request(url, None, std_headers)
|
||||||
try:
|
try:
|
||||||
self.report_download_webpage(video_id)
|
self.report_download_webpage(video_id)
|
||||||
webpage = compat_urllib_request.urlopen(request).read()
|
webpage_bytes = compat_urllib_request.urlopen(request).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 retrieve video webpage: %s' % compat_str(err))
|
self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err))
|
||||||
return
|
return
|
||||||
|
@ -1090,7 +1091,7 @@ def _real_extract(self, url, new_video=True):
|
||||||
video_thumbnail = config["video"]["thumbnail"]
|
video_thumbnail = config["video"]["thumbnail"]
|
||||||
|
|
||||||
# Extract video description
|
# Extract video description
|
||||||
video_description = get_element_by_id("description", webpage.decode('utf8'))
|
video_description = get_element_by_id("description", webpage)
|
||||||
if video_description: video_description = clean_html(video_description)
|
if video_description: video_description = clean_html(video_description)
|
||||||
else: video_description = ''
|
else: video_description = ''
|
||||||
|
|
||||||
|
@ -1408,22 +1409,22 @@ def _real_extract(self, url):
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
self._downloader.trouble(u'ERROR: unable to extract title')
|
self._downloader.trouble(u'ERROR: unable to extract title')
|
||||||
return
|
return
|
||||||
video_title = mobj.group(1).decode('utf-8')
|
video_title = mobj.group(1)
|
||||||
|
|
||||||
# video uploader is domain name
|
# video uploader is domain name
|
||||||
mobj = re.match(r'(?:https?://)?([^/]*)/.*', url)
|
mobj = re.match(r'(?:https?://)?([^/]*)/.*', url)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
self._downloader.trouble(u'ERROR: unable to extract title')
|
self._downloader.trouble(u'ERROR: unable to extract title')
|
||||||
return
|
return
|
||||||
video_uploader = mobj.group(1).decode('utf-8')
|
video_uploader = mobj.group(1)
|
||||||
|
|
||||||
return [{
|
return [{
|
||||||
'id': video_id.decode('utf-8'),
|
'id': video_id,
|
||||||
'url': video_url.decode('utf-8'),
|
'url': video_url,
|
||||||
'uploader': video_uploader,
|
'uploader': video_uploader,
|
||||||
'upload_date': None,
|
'upload_date': None,
|
||||||
'title': video_title,
|
'title': video_title,
|
||||||
'ext': video_extension.decode('utf-8'),
|
'ext': video_extension,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue