1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-14 07:57:15 +08:00

works correctly with the youtube-dl IE architecture

previous commit returned media URL, but this one retrieves it and uses it to download
This commit is contained in:
Louis 2012-08-28 19:27:52 +03:00
parent eb6cf05f2a
commit 09729eb337

View File

@ -627,21 +627,24 @@ class DailymotionIE(InfoExtractor):
self._downloader.trouble(u'ERROR: unable retrieve video webpage: %s' % str(err))
return
# Extract URL, uploader and title from webpage
# Extract URL, uploader and title from webpage
mediaURL = None
self.report_extraction(video_id)
mobj = re.search(r'(?i)addVariable\(\"sequence\"\s*,\s*\"([^\"]+?)\"\)', webpage)
if mobj is None:
mobj = re.search(r'"video_url":"(.*?)",', urllib.unquote(webpage))
if mobj:
return urllib.unquote(mobj.group(1))
self._downloader.trouble(u'ERROR: unable to extract media URL')
return
if mobj:
mediaURL = urllib.unquote(mobj.group(1))
else:
self._downloader.trouble(u'ERROR: unable to extract media URL')
return
sequence = urllib.unquote(mobj.group(1))
mobj = re.search(r',\"sdURL\"\:\"([^\"]+?)\",', sequence)
if mobj is None:
if mobj is None and not mediaURL:
self._downloader.trouble(u'ERROR: unable to extract media URL')
return
mediaURL = urllib.unquote(mobj.group(1)).replace('\\', '')
if not mediaURL:
mediaURL = urllib.unquote(mobj.group(1)).replace('\\', '')
# if needed add http://www.dailymotion.com/ if relative URL