]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
Not all Dailymotion videos have an hqURL, now downloads highest quality available
authorFilippo Valsorda <filosottile.wiki@gmail.com>
Sat, 29 Sep 2012 14:53:06 +0000 (16:53 +0200)
committerFilippo Valsorda <filosottile.wiki@gmail.com>
Sat, 29 Sep 2012 14:53:06 +0000 (16:53 +0200)
youtube-dl
youtube_dl/InfoExtractors.py

index 3a9fb1d4a6d970f8b5b5b44160a5bddbfe8d73bc..fd5e09c3b710e6b833f7fc4a67fa14b4141d3eb2 100755 (executable)
Binary files a/youtube-dl and b/youtube-dl differ
index 2a86c505bce6114fbf7fbb9de5138f4a02360f97..4fcff77ff7e55ee4ff3c7a4e8fb7d940b72cb716 100644 (file)
@@ -636,13 +636,16 @@ class DailymotionIE(InfoExtractor):
                        self._downloader.trouble(u'ERROR: unable to extract media URL')
                        return
                flashvars = urllib.unquote(mobj.group(1))
-               mobj = re.search(r'"hqURL":"(.+?)"', flashvars)
+               if 'hqURL' in flashvars: max_quality = 'hqURL'
+               elif 'sdURL' in flashvars: max_quality = 'sdURL'
+               else: max_quality = 'ldURL'
+               mobj = re.search(r'"' + max_quality + r'":"(.+?)"', flashvars)
                if mobj is None:
                        self._downloader.trouble(u'ERROR: unable to extract media URL')
                        return
-               hqURL = mobj.group(1).replace('\\/', '/')
+               video_url = mobj.group(1).replace('\\/', '/')
 
-               # TODO: support ldurl and sdurl qualities
+               # TODO: support choosing qualities
 
                mobj = re.search(r'<meta property="og:title" content="(?P<title>[^"]*)" />', webpage)
                if mobj is None:
@@ -658,7 +661,7 @@ class DailymotionIE(InfoExtractor):
 
                return [{
                        'id':           video_id.decode('utf-8'),
-                       'url':          hqURL.decode('utf-8'),
+                       'url':          video_url.decode('utf-8'),
                        'uploader':     video_uploader.decode('utf-8'),
                        'upload_date':  u'NA',
                        'title':        video_title,