From 09729eb337d0740f255c3f9d991731a9d6e2f15b Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 28 Aug 2012 19:27:52 +0300 Subject: [PATCH] works correctly with the youtube-dl IE architecture previous commit returned media URL, but this one retrieves it and uses it to download --- youtube_dl/InfoExtractors.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py index 10f2bab9f..ce34c1a36 100644 --- a/youtube_dl/InfoExtractors.py +++ b/youtube_dl/InfoExtractors.py @@ -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