]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[brightcove:new] Raise GeoRestrictedError
authorSergey M․ <dstftw@gmail.com>
Fri, 3 Mar 2017 15:49:48 +0000 (22:49 +0700)
committerSergey M․ <dstftw@gmail.com>
Fri, 3 Mar 2017 15:49:48 +0000 (22:49 +0700)
youtube_dl/extractor/brightcove.py

index 27685eed0188312154463066293018496e875e5c..f8605be82f0ab5453836ec9497ef9b8700be0e97 100644 (file)
@@ -544,8 +544,10 @@ 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)[0]
-                raise ExtractorError(
-                    json_data.get('message') or json_data['error_code'], expected=True)
+                message = json_data.get('message') or json_data['error_code']
+                if json_data.get('error_subcode') == 'CLIENT_GEO':
+                    self.raise_geo_restricted(msg=message)
+                raise ExtractorError(message, expected=True)
             raise
 
         title = json_data['name'].strip()