1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-09-20 18:35:32 +00:00

Handle badly encoded Dailymotion JSON

This commit is contained in:
Laurent Raufaste 2011-05-29 13:59:10 -04:00
parent a4188f6acd
commit b95ed52358

View file

@ -1338,11 +1338,15 @@ class DailymotionIE(InfoExtractor):
# if needed add http://www.dailymotion.com/ if relative URL
sequenceJsonContent = urllib.unquote_plus(mobj.group(1))
sequenceJson = json.loads(sequenceJsonContent)
try:
sequenceJson = json.loads(sequenceJsonContent)
except:
self._downloader.trouble(u'ERROR: unable to extract media URL (Bad JSON encoding)')
return
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')
self._downloader.trouble(u'ERROR: unable to extract media URL (Unable to find the URL)')
return
# '<meta\s+name="title"\s+content="Dailymotion\s*[:\-]\s*(.*?)"\s*\/\s*>'