mirror of
https://github.com/l1ving/youtube-dl
synced 2025-02-03 15:53:20 +08:00
DailymotionIE: Added hd1080URL, hd720URL, hqURL support. Now video_uploader is optional.
This commit is contained in:
parent
efb113c736
commit
7401ca7c5f
22
youtube-dl
22
youtube-dl
@ -1563,12 +1563,19 @@ class DailymotionIE(InfoExtractor):
|
|||||||
|
|
||||||
# Extract URL, uploader and title from webpage
|
# Extract URL, uploader and title from webpage
|
||||||
self.report_extraction(video_id)
|
self.report_extraction(video_id)
|
||||||
mobj = re.search(r'(?i)addVariable\(\"sequence\"\s*,\s*\"([^\"]+?)\"\)', webpage)
|
mobj = re.search(r'(?i)addVariable\(\"sequence\"\s*,\s*\"([^\"]+)\"\)', webpage)
|
||||||
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
|
||||||
sequence = urllib.unquote(mobj.group(1))
|
sequence = urllib.unquote(mobj.group(1))
|
||||||
mobj = re.search(r',\"sdURL\"\:\"([^\"]+?)\",', sequence)
|
|
||||||
|
mobj = None
|
||||||
|
for key in ['hd1080URL', 'hd720URL', 'hqURL', 'sdURL']:
|
||||||
|
pattern = re.compile(r',\"%s\"\:\"([^\"]+)\",' % key)
|
||||||
|
mobj = re.search(pattern, sequence)
|
||||||
|
if mobj is not None:
|
||||||
|
self._downloader.to_screen(u'[dailymotion] Using %s' % key)
|
||||||
|
break
|
||||||
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
|
||||||
@ -1578,18 +1585,19 @@ class DailymotionIE(InfoExtractor):
|
|||||||
|
|
||||||
video_url = mediaURL
|
video_url = mediaURL
|
||||||
|
|
||||||
mobj = re.search(r'(?im)<title>Dailymotion\s*-\s*(.+)\s*-\s*[^<]+?</title>', webpage)
|
mobj = re.search(r'(?im)<title>Dailymotion\s*-\s*(.+)\s*-\s*[^<]+</title>', webpage)
|
||||||
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).decode('utf-8')
|
||||||
video_title = sanitize_title(video_title)
|
video_title = sanitize_title(video_title)
|
||||||
|
|
||||||
mobj = re.search(r'(?im)<span class="owner[^\"]+?">[^<]+?<a [^>]+?>([^<]+?)</a></span>', webpage)
|
video_uploader = ''
|
||||||
|
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.to_screen(u'WARNING: unable to extract uploader nickname')
|
||||||
return
|
else:
|
||||||
video_uploader = mobj.group(1)
|
video_uploader = mobj.group(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Process video information
|
# Process video information
|
||||||
|
Loading…
Reference in New Issue
Block a user