mirror of
https://github.com/l1ving/youtube-dl
synced 2025-03-10 06:17:16 +08:00
Fixed dailymotion video nd uploader extractor
This commit is contained in:
parent
4b0d9eed45
commit
368cb1fd0a
21
youtube-dl
21
youtube-dl
@ -30,6 +30,7 @@ import time
|
|||||||
import urllib
|
import urllib
|
||||||
import urllib2
|
import urllib2
|
||||||
import zlib
|
import zlib
|
||||||
|
import json
|
||||||
|
|
||||||
# parse_qs was moved from the cgi module to the urlparse module recently.
|
# parse_qs was moved from the cgi module to the urlparse module recently.
|
||||||
try:
|
try:
|
||||||
@ -1328,16 +1329,21 @@ class DailymotionIE(InfoExtractor):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Extract URL, uploader and title from webpage
|
# Extract URL, uploader and title from webpage
|
||||||
|
# First we need to get the sequence urlencoded json variable
|
||||||
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))
|
|
||||||
|
|
||||||
# if needed add http://www.dailymotion.com/ if relative URL
|
# if needed add http://www.dailymotion.com/ if relative URL
|
||||||
|
sequenceJsonContent = urllib.unquote_plus(mobj.group(1))
|
||||||
video_url = mediaURL
|
sequenceJson = json.loads(sequenceJsonContent)
|
||||||
|
try:
|
||||||
|
video_url = sequenceJson[0]["layerList"][0]["sequenceList"][1]["layerList"][2]["param"]["videoPluginParameters"]["hqURL"]
|
||||||
|
except:
|
||||||
|
self._downloader.trouble(u'ERROR: unable to extract media URL')
|
||||||
|
return
|
||||||
|
|
||||||
# '<meta\s+name="title"\s+content="Dailymotion\s*[:\-]\s*(.*?)"\s*\/\s*>'
|
# '<meta\s+name="title"\s+content="Dailymotion\s*[:\-]\s*(.*?)"\s*\/\s*>'
|
||||||
mobj = re.search(r'(?im)<title>Dailymotion\s*[\-:]\s*(.+?)</title>', webpage)
|
mobj = re.search(r'(?im)<title>Dailymotion\s*[\-:]\s*(.+?)</title>', webpage)
|
||||||
@ -1347,11 +1353,12 @@ class DailymotionIE(InfoExtractor):
|
|||||||
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)
|
# Extract the video uploader nickname from the sequence JSON
|
||||||
if mobj is None:
|
try:
|
||||||
|
video_uploader = sequenceJson[0]["layerList"][0]["sequenceList"][1]["layerList"][0]["param"]["metadata"]["uploader"]
|
||||||
|
except:
|
||||||
self._downloader.trouble(u'ERROR: unable to extract uploader nickname')
|
self._downloader.trouble(u'ERROR: unable to extract uploader nickname')
|
||||||
return
|
return
|
||||||
video_uploader = mobj.group(1)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Process video information
|
# Process video information
|
||||||
|
Loading…
x
Reference in New Issue
Block a user