[brightcove] improve error detection
authorRemita Amine <remitamine@gmail.com>
Sun, 3 Jul 2016 15:33:50 +0000 (16:33 +0100)
committerRemita Amine <remitamine@gmail.com>
Sun, 3 Jul 2016 15:37:22 +0000 (16:37 +0100)
youtube_dl/extractor/brightcove.py

index ef560b592792910c2d39174eb2db129cea5590fe..b49b1977dba920bb6cdffb9904d2c5a6a44acd9c 100644 (file)
@@ -585,6 +585,13 @@ class BrightcoveNewIE(InfoExtractor):
                         'format_id': build_format_id('rtmp'),
                     })
                 formats.append(f)
+
+        errors = json_data.get('errors')
+        if not formats and errors:
+            error = errors[0]
+            raise ExtractorError(
+                error.get('message') or error.get('error_subcode') or error['error_code'], expected=True)
+
         self._sort_formats(formats)
 
         subtitles = {}