aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/InfoExtractors.py
diff options
context:
space:
mode:
authorFilippo Valsorda <filosottile.wiki@gmail.com>2012-09-29 16:38:38 +0200
committerFilippo Valsorda <filosottile.wiki@gmail.com>2012-09-29 16:38:38 +0200
commit349e2e3e21aeb274eaf901339e7397671d10a2d3 (patch)
tree5e040d2b587dbbd0df1ca40692300a12c8e06437 /youtube_dl/InfoExtractors.py
parent551fa9dfbfce54f409abef4f826fb8a1a84c8a3d (diff)
Fixed DailymotionIE, now downloads high-def mp4s, which might be too much (?)
Diffstat (limited to 'youtube_dl/InfoExtractors.py')
-rw-r--r--youtube_dl/InfoExtractors.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py
index 6442888d8..2a86c505b 100644
--- a/youtube_dl/InfoExtractors.py
+++ b/youtube_dl/InfoExtractors.py
@@ -617,7 +617,7 @@ class DailymotionIE(InfoExtractor):
video_id = mobj.group(1)
- video_extension = 'flv'
+ video_extension = 'mp4'
# Retrieve video webpage to extract further information
request = urllib2.Request(url)
@@ -631,20 +631,18 @@ 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'\s*var flashvars = (.*)', 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)
+ flashvars = urllib.unquote(mobj.group(1))
+ mobj = re.search(r'"hqURL":"(.+?)"', flashvars)
if mobj is None:
self._downloader.trouble(u'ERROR: unable to extract media URL')
return
- mediaURL = urllib.unquote(mobj.group(1)).replace('\\', '')
+ hqURL = mobj.group(1).replace('\\/', '/')
- # if needed add http://www.dailymotion.com/ if relative URL
-
- video_url = mediaURL
+ # TODO: support ldurl and sdurl qualities
mobj = re.search(r'<meta property="og:title" content="(?P<title>[^"]*)" />', webpage)
if mobj is None:
@@ -660,7 +658,7 @@ class DailymotionIE(InfoExtractor):
return [{
'id': video_id.decode('utf-8'),
- 'url': video_url.decode('utf-8'),
+ 'url': hqURL.decode('utf-8'),
'uploader': video_uploader.decode('utf-8'),
'upload_date': u'NA',
'title': video_title,