1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2025-04-15 03:19:46 +00:00
This commit is contained in:
GitHub Merge Button 2011-11-29 11:23:06 -08:00
commit 8ead1ce9ce

View File

@ -1603,12 +1603,19 @@ class DailymotionIE(InfoExtractor):
# Extract URL, uploader and title from webpage
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:
self._downloader.trouble(u'ERROR: unable to extract media URL')
return
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:
self._downloader.trouble(u'ERROR: unable to extract media URL')
return
@ -1618,18 +1625,19 @@ class DailymotionIE(InfoExtractor):
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:
self._downloader.trouble(u'ERROR: unable to extract title')
return
video_title = mobj.group(1).decode('utf-8')
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:
self._downloader.trouble(u'ERROR: unable to extract uploader nickname')
return
video_uploader = mobj.group(1)
self._downloader.to_screen(u'WARNING: unable to extract uploader nickname')
else:
video_uploader = mobj.group(1)
try:
# Process video information