mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-07 20:30:41 -05:00
Re-engineered Dailymotion qualities selection (thanks @knagano, sort of merges #176)
This commit is contained in:
parent
fd873c69a4
commit
0bfd0b598a
1 changed files with 16 additions and 9 deletions
|
@ -658,15 +658,21 @@ 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))
|
||||||
if 'hqURL' in flashvars: max_quality = 'hqURL'
|
|
||||||
elif 'sdURL' in flashvars: max_quality = 'sdURL'
|
for key in ['hd1080URL', 'hd720URL', 'hqURL', 'sdURL', 'ldURL', 'video_url']:
|
||||||
else: max_quality = 'ldURL'
|
if key in flashvars:
|
||||||
|
max_quality = key
|
||||||
|
self._downloader.to_screen(u'[dailymotion] Using %s' % key)
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
self._downloader.trouble(u'ERROR: unable to extract video URL')
|
||||||
|
return
|
||||||
|
|
||||||
mobj = re.search(r'"' + max_quality + r'":"(.+?)"', flashvars)
|
mobj = re.search(r'"' + max_quality + r'":"(.+?)"', flashvars)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
mobj = re.search(r'"video_url":"(.*?)",', flashvars)
|
self._downloader.trouble(u'ERROR: unable to extract video URL')
|
||||||
if mobj is None:
|
|
||||||
self._downloader.trouble(u'ERROR: unable to extract media URL')
|
|
||||||
return
|
return
|
||||||
|
|
||||||
video_url = urllib.unquote(mobj.group(1)).replace('\\/', '/')
|
video_url = urllib.unquote(mobj.group(1)).replace('\\/', '/')
|
||||||
|
|
||||||
# TODO: support choosing qualities
|
# TODO: support choosing qualities
|
||||||
|
@ -677,11 +683,12 @@ def _real_extract(self, url):
|
||||||
return
|
return
|
||||||
video_title = unescapeHTML(mobj.group('title').decode('utf-8'))
|
video_title = unescapeHTML(mobj.group('title').decode('utf-8'))
|
||||||
|
|
||||||
|
video_uploader = u'NA'
|
||||||
mobj = re.search(r'(?im)<span class="owner[^\"]+?">[^<]+?<a [^>]+?>([^<]+?)</a></span>', webpage)
|
mobj = re.search(r'(?im)<span class="owner[^\"]+?">[^<]+?<a [^>]+?>([^<]+?)</a></span>', webpage)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
self._downloader.trouble(u'ERROR: unable to extract uploader nickname')
|
self._downloader.trouble(u'WARNING: unable to extract uploader nickname')
|
||||||
return
|
else:
|
||||||
video_uploader = mobj.group(1)
|
video_uploader = mobj.group(1)
|
||||||
|
|
||||||
video_upload_date = u'NA'
|
video_upload_date = u'NA'
|
||||||
mobj = re.search(r'<div class="[^"]*uploaded_cont[^"]*" title="[^"]*">([0-9]{2})-([0-9]{2})-([0-9]{4})</div>', webpage)
|
mobj = re.search(r'<div class="[^"]*uploaded_cont[^"]*" title="[^"]*">([0-9]{2})-([0-9]{2})-([0-9]{4})</div>', webpage)
|
||||||
|
|
Loading…
Reference in a new issue