diff --git a/youtube-dl b/youtube-dl index 3ac27a857..bd666071d 100755 --- a/youtube-dl +++ b/youtube-dl @@ -30,6 +30,7 @@ import time import urllib import urllib2 import zlib +import json # parse_qs was moved from the cgi module to the urlparse module recently. try: @@ -1328,16 +1329,21 @@ class DailymotionIE(InfoExtractor): return # Extract URL, uploader and title from webpage + # First we need to get the sequence urlencoded json variable 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: self._downloader.trouble(u'ERROR: unable to extract media URL') return - mediaURL = urllib.unquote(mobj.group(1)) # if needed add http://www.dailymotion.com/ if relative URL - - video_url = mediaURL + sequenceJsonContent = urllib.unquote_plus(mobj.group(1)) + 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 # '' mobj = re.search(r'(?im)