Fixed DailymotionIE, now downloads high-def mp4s, which might be too much (?)

This commit is contained in:
Filippo Valsorda 2012-09-29 16:38:38 +02:00
parent 551fa9dfbf
commit 349e2e3e21
2 changed files with 7 additions and 9 deletions

Binary file not shown.

View file

@ -617,7 +617,7 @@ def _real_extract(self, url):
video_id = mobj.group(1) video_id = mobj.group(1)
video_extension = 'flv' video_extension = 'mp4'
# Retrieve video webpage to extract further information # Retrieve video webpage to extract further information
request = urllib2.Request(url) request = urllib2.Request(url)
@ -631,20 +631,18 @@ def _real_extract(self, url):
# Extract URL, uploader and title from webpage # Extract URL, uploader and title from webpage
self.report_extraction(video_id) 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: if mobj is None:
self._downloader.trouble(u'ERROR: unable to extract media URL') self._downloader.trouble(u'ERROR: unable to extract media URL')
return return
sequence = urllib.unquote(mobj.group(1)) flashvars = urllib.unquote(mobj.group(1))
mobj = re.search(r',\"sdURL\"\:\"([^\"]+?)\",', sequence) mobj = re.search(r'"hqURL":"(.+?)"', flashvars)
if mobj is None: if mobj is None:
self._downloader.trouble(u'ERROR: unable to extract media URL') self._downloader.trouble(u'ERROR: unable to extract media URL')
return return
mediaURL = urllib.unquote(mobj.group(1)).replace('\\', '') hqURL = mobj.group(1).replace('\\/', '/')
# if needed add http://www.dailymotion.com/ if relative URL # TODO: support ldurl and sdurl qualities
video_url = mediaURL
mobj = re.search(r'<meta property="og:title" content="(?P<title>[^"]*)" />', webpage) mobj = re.search(r'<meta property="og:title" content="(?P<title>[^"]*)" />', webpage)
if mobj is None: if mobj is None:
@ -660,7 +658,7 @@ def _real_extract(self, url):
return [{ return [{
'id': video_id.decode('utf-8'), 'id': video_id.decode('utf-8'),
'url': video_url.decode('utf-8'), 'url': hqURL.decode('utf-8'),
'uploader': video_uploader.decode('utf-8'), 'uploader': video_uploader.decode('utf-8'),
'upload_date': u'NA', 'upload_date': u'NA',
'title': video_title, 'title': video_title,