about summary refs log tree commit diff
path: root/youtube_dl/extractor/brightcove.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-05-21 00:59:06 +0600
committerSergey M․ <dstftw@gmail.com>2016-05-21 00:59:06 +0600
commitb219f5e51be520b2e23acd1ec08735fc733f9619 (patch)
tree8ed78e7c948cb9ec9192e9705e21104d57257726 /youtube_dl/extractor/brightcove.py
parent1846e9ade0fb9508459282a992539c700aa26f9c (diff)
downloadyoutube-dl-b219f5e51be520b2e23acd1ec08735fc733f9619.tar.gz
youtube-dl-b219f5e51be520b2e23acd1ec08735fc733f9619.tar.xz
youtube-dl-b219f5e51be520b2e23acd1ec08735fc733f9619.zip
[brightcove:new] Improve error reporting
Diffstat (limited to 'youtube_dl/extractor/brightcove.py')
-rw-r--r--youtube_dl/extractor/brightcove.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/youtube_dl/extractor/brightcove.py b/youtube_dl/extractor/brightcove.py
index fc7fc5b16..ef560b592 100644
--- a/youtube_dl/extractor/brightcove.py
+++ b/youtube_dl/extractor/brightcove.py
@@ -444,6 +444,10 @@ class BrightcoveNewIE(InfoExtractor):
         # non numeric ref: prefixed video id
         'url': 'http://players.brightcove.net/710858724001/default_default/index.html?videoId=ref:event-stream-356',
         'only_matching': True,
+    }, {
+        # unavailable video without message but with error_code
+        'url': 'http://players.brightcove.net/1305187701/c832abfb-641b-44eb-9da0-2fe76786505f_default/index.html?videoId=4377407326001',
+        'only_matching': True,
     }]
 
     @staticmethod
@@ -514,8 +518,9 @@ class BrightcoveNewIE(InfoExtractor):
             })
         except ExtractorError as e:
             if isinstance(e.cause, compat_HTTPError) and e.cause.code == 403:
-                json_data = self._parse_json(e.cause.read().decode(), video_id)
-                raise ExtractorError(json_data[0]['message'], expected=True)
+                json_data = self._parse_json(e.cause.read().decode(), video_id)[0]
+                raise ExtractorError(
+                    json_data.get('message') or json_data['error_code'], expected=True)
             raise
 
         title = json_data['name'].strip()