Fixed download from Dailymotion.
Fetches FLV URL from "sdURL" in addVariable("sequence") JSON, instead of addVariable("video") which doesnot exist today. Supports new title, uploader nickname format.
This commit is contained in:
parent
4b0d9eed45
commit
62a29bbf7b
15
youtube-dl
15
youtube-dl
|
@ -1320,6 +1320,7 @@ class DailymotionIE(InfoExtractor):
|
||||||
|
|
||||||
# Retrieve video webpage to extract further information
|
# Retrieve video webpage to extract further information
|
||||||
request = urllib2.Request(url)
|
request = urllib2.Request(url)
|
||||||
|
request.add_header('Cookie', 'family_filter=off')
|
||||||
try:
|
try:
|
||||||
self.report_download_webpage(video_id)
|
self.report_download_webpage(video_id)
|
||||||
webpage = urllib2.urlopen(request).read()
|
webpage = urllib2.urlopen(request).read()
|
||||||
|
@ -1329,25 +1330,29 @@ class DailymotionIE(InfoExtractor):
|
||||||
|
|
||||||
# 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\(\"video\"\s*,\s*\"([^\"]*)\"\)', webpage)
|
mobj = re.search(r'(?i)addVariable\(\"sequence\"\s*,\s*\"([^\"]+?)\"\)', 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
|
||||||
mediaURL = urllib.unquote(mobj.group(1))
|
sequence = urllib.unquote(mobj.group(1))
|
||||||
|
mobj = re.search(r',\"sdURL\"\:\"([^\"]+?)\",', sequence)
|
||||||
|
if mobj is None:
|
||||||
|
self._downloader.trouble(u'ERROR: unable to extract media URL')
|
||||||
|
return
|
||||||
|
mediaURL = urllib.unquote(mobj.group(1)).replace('\\', '')
|
||||||
|
|
||||||
# if needed add http://www.dailymotion.com/ if relative URL
|
# if needed add http://www.dailymotion.com/ if relative URL
|
||||||
|
|
||||||
video_url = mediaURL
|
video_url = mediaURL
|
||||||
|
|
||||||
# '<meta\s+name="title"\s+content="Dailymotion\s*[:\-]\s*(.*?)"\s*\/\s*>'
|
mobj = re.search(r'(?im)<title>Dailymotion\s*-\s*(.+)\s*-\s*[^<]+?</title>', webpage)
|
||||||
mobj = re.search(r'(?im)<title>Dailymotion\s*[\-:]\s*(.+?)</title>', webpage)
|
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
self._downloader.trouble(u'ERROR: unable to extract title')
|
self._downloader.trouble(u'ERROR: unable to extract title')
|
||||||
return
|
return
|
||||||
video_title = mobj.group(1).decode('utf-8')
|
video_title = mobj.group(1).decode('utf-8')
|
||||||
video_title = sanitize_title(video_title)
|
video_title = sanitize_title(video_title)
|
||||||
|
|
||||||
mobj = re.search(r'(?im)<Attribute name="owner">(.+?)</Attribute>', webpage)
|
mobj = re.search(r'(?im)<span class="owner[^\"]+?">[^<]+?<a [^>]+?>([^<]+?)</a></span>', webpage)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
self._downloader.trouble(u'ERROR: unable to extract uploader nickname')
|
self._downloader.trouble(u'ERROR: unable to extract uploader nickname')
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue