mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-24 20:41:00 +00:00
Not all Dailymotion videos have an hqURL, now downloads highest quality available
This commit is contained in:
parent
349e2e3e21
commit
3c4d6c9eba
2 changed files with 7 additions and 4 deletions
BIN
youtube-dl
BIN
youtube-dl
Binary file not shown.
|
@ -636,13 +636,16 @@ def _real_extract(self, url):
|
||||||
self._downloader.trouble(u'ERROR: unable to extract media URL')
|
self._downloader.trouble(u'ERROR: unable to extract media URL')
|
||||||
return
|
return
|
||||||
flashvars = urllib.unquote(mobj.group(1))
|
flashvars = urllib.unquote(mobj.group(1))
|
||||||
mobj = re.search(r'"hqURL":"(.+?)"', flashvars)
|
if 'hqURL' in flashvars: max_quality = 'hqURL'
|
||||||
|
elif 'sdURL' in flashvars: max_quality = 'sdURL'
|
||||||
|
else: max_quality = 'ldURL'
|
||||||
|
mobj = re.search(r'"' + max_quality + r'":"(.+?)"', flashvars)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
self._downloader.trouble(u'ERROR: unable to extract media URL')
|
self._downloader.trouble(u'ERROR: unable to extract media URL')
|
||||||
return
|
return
|
||||||
hqURL = mobj.group(1).replace('\\/', '/')
|
video_url = mobj.group(1).replace('\\/', '/')
|
||||||
|
|
||||||
# TODO: support ldurl and sdurl qualities
|
# TODO: support choosing qualities
|
||||||
|
|
||||||
mobj = re.search(r'<meta property="og:title" content="(?P<title>[^"]*)" />', webpage)
|
mobj = re.search(r'<meta property="og:title" content="(?P<title>[^"]*)" />', webpage)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
|
@ -658,7 +661,7 @@ def _real_extract(self, url):
|
||||||
|
|
||||||
return [{
|
return [{
|
||||||
'id': video_id.decode('utf-8'),
|
'id': video_id.decode('utf-8'),
|
||||||
'url': hqURL.decode('utf-8'),
|
'url': video_url.decode('utf-8'),
|
||||||
'uploader': video_uploader.decode('utf-8'),
|
'uploader': video_uploader.decode('utf-8'),
|
||||||
'upload_date': u'NA',
|
'upload_date': u'NA',
|
||||||
'title': video_title,
|
'title': video_title,
|
||||||
|
|
Loading…
Reference in a new issue