From b95ed5235876a3fdf536bcfde6eaf1e721ab00ba Mon Sep 17 00:00:00 2001 From: Laurent Raufaste Date: Sun, 29 May 2011 13:59:10 -0400 Subject: [PATCH] Handle badly encoded Dailymotion JSON --- youtube-dl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/youtube-dl b/youtube-dl index 8e277f39f..df16da48e 100755 --- a/youtube-dl +++ b/youtube-dl @@ -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 # ''