From 39ed09b7acbbd011f30614948e3e8c8da77c5925 Mon Sep 17 00:00:00 2001 From: Nekmo Date: Sat, 17 Feb 2018 20:04:59 +0100 Subject: [PATCH 1/2] Fix error 500 --- youtube_dl/extractor/atresplayer.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/atresplayer.py b/youtube_dl/extractor/atresplayer.py index 1a31ebe08..d5e80894f 100644 --- a/youtube_dl/extractor/atresplayer.py +++ b/youtube_dl/extractor/atresplayer.py @@ -144,8 +144,16 @@ class AtresPlayerIE(InfoExtractor): self._URL_VIDEO_TEMPLATE.format('windows', episode_id, timestamp_shifted, token), headers={'User-Agent': self._USER_AGENT}) - fmt_json = self._download_json( - request, video_id, 'Downloading windows video JSON') + try: + fmt_json = self._download_json( + request, video_id, 'Downloading windows video JSON') + except ExtractorError as e: + fmt_json = {'resultObject': {}} + else: + result = fmt_json.get('resultDes') + if result.lower() != 'ok': + raise ExtractorError( + '%s returned error: %s' % (self.IE_NAME, result), expected=True) result = fmt_json.get('resultDes') if result.lower() != 'ok': From 8364a6ef478cc2f9bcd42971ffb47f945a14cdaa Mon Sep 17 00:00:00 2001 From: Nekmo Date: Sun, 18 Feb 2018 01:39:18 +0100 Subject: [PATCH 2/2] Fixed code typo --- youtube_dl/extractor/atresplayer.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/youtube_dl/extractor/atresplayer.py b/youtube_dl/extractor/atresplayer.py index d5e80894f..9a556ee70 100644 --- a/youtube_dl/extractor/atresplayer.py +++ b/youtube_dl/extractor/atresplayer.py @@ -155,11 +155,6 @@ class AtresPlayerIE(InfoExtractor): raise ExtractorError( '%s returned error: %s' % (self.IE_NAME, result), expected=True) - result = fmt_json.get('resultDes') - if result.lower() != 'ok': - raise ExtractorError( - '%s returned error: %s' % (self.IE_NAME, result), expected=True) - for format_id, video_url in fmt_json['resultObject'].items(): if format_id == 'token' or not video_url.startswith('http'): continue