aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorFilippo Valsorda <filosottile.wiki@gmail.com>2012-09-29 16:53:06 +0200
committerFilippo Valsorda <filosottile.wiki@gmail.com>2012-09-29 16:53:06 +0200
commit3c4d6c9ebae975bafcf3ae1b8d419cb734b50581 (patch)
tree95926802f3c171410ec8b2d22d5b7460d9a1e60e /youtube_dl
parent349e2e3e21aeb274eaf901339e7397671d10a2d3 (diff)
Not all Dailymotion videos have an hqURL, now downloads highest quality available
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/InfoExtractors.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py
index 2a86c505b..4fcff77ff 100644
--- a/youtube_dl/InfoExtractors.py
+++ b/youtube_dl/InfoExtractors.py
@@ -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,