about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2016-04-16 16:47:16 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2016-04-16 16:47:16 +0800
commitae65567102336f45a211a91e39d21f6d8aaecbbd (patch)
tree8b01a7270d209f0eb5da99d40a6149d65d14b57d
parentc394b4f4cb6d6071613a1733d0c3188e5882f476 (diff)
downloadyoutube-dl-ae65567102336f45a211a91e39d21f6d8aaecbbd.tar.gz
youtube-dl-ae65567102336f45a211a91e39d21f6d8aaecbbd.tar.xz
youtube-dl-ae65567102336f45a211a91e39d21f6d8aaecbbd.zip
[eagleplatform] Fix error handling
-rw-r--r--youtube_dl/extractor/eagleplatform.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/youtube_dl/extractor/eagleplatform.py b/youtube_dl/extractor/eagleplatform.py
index 7bbf617d4..fa3cb7023 100644
--- a/youtube_dl/extractor/eagleplatform.py
+++ b/youtube_dl/extractor/eagleplatform.py
@@ -4,6 +4,7 @@ from __future__ import unicode_literals
 import re
 
 from .common import InfoExtractor
+from ..compat import compat_HTTPError
 from ..utils import (
     ExtractorError,
     int_or_none,
@@ -55,8 +56,13 @@ class EaglePlatformIE(InfoExtractor):
             raise ExtractorError(' '.join(response['errors']), expected=True)
 
     def _download_json(self, url_or_request, video_id, note='Downloading JSON metadata'):
-        response = super(EaglePlatformIE, self)._download_json(url_or_request, video_id, note)
-        self._handle_error(response)
+        try:
+            response = super(EaglePlatformIE, self)._download_json(url_or_request, video_id, note)
+        except ExtractorError as ee:
+            if isinstance(ee.cause, compat_HTTPError):
+                response = self._parse_json(ee.cause.read().decode('utf-8'), video_id)
+                self._handle_error(response)
+            raise
         return response
 
     def _get_video_url(self, url_or_request, video_id, note='Downloading JSON metadata'):