diff options
author | Sergey M․ <dstftw@gmail.com> | 2017-02-04 18:55:23 +0700 |
---|---|---|
committer | Sergey M <dstftw@gmail.com> | 2017-02-19 05:10:08 +0800 |
commit | 71631862f4de5a10223642ebdbd5e10db374d270 (patch) | |
tree | f0d395ccd3c5a9f882644d073a633555be064ec4 /youtube_dl | |
parent | 89cc7fe7705b6534f434b514265a0507b70ef40f (diff) |
[srgssr] Improve geo restriction detection
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/srgssr.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/youtube_dl/extractor/srgssr.py b/youtube_dl/extractor/srgssr.py index 319a48a7a..a35a0a538 100644 --- a/youtube_dl/extractor/srgssr.py +++ b/youtube_dl/extractor/srgssr.py @@ -14,6 +14,7 @@ from ..utils import ( class SRGSSRIE(InfoExtractor): _VALID_URL = r'(?:https?://tp\.srgssr\.ch/p(?:/[^/]+)+\?urn=urn|srgssr):(?P<bu>srf|rts|rsi|rtr|swi):(?:[^:]+:)?(?P<type>video|audio):(?P<id>[0-9a-f\-]{36}|\d+)' + _BYPASS_GEO = False _ERRORS = { 'AGERATING12': 'To protect children under the age of 12, this video is only available between 8 p.m. and 6 a.m.', @@ -40,8 +41,11 @@ class SRGSSRIE(InfoExtractor): media_id)[media_type.capitalize()] if media_data.get('block') and media_data['block'] in self._ERRORS: - raise ExtractorError('%s said: %s' % ( - self.IE_NAME, self._ERRORS[media_data['block']]), expected=True) + message = self._ERRORS[media_data['block']] + if media_data['block'] == 'GEOBLOCK': + self.raise_geo_restricted(msg=message, countries=['CH']) + raise ExtractorError( + '%s said: %s' % (self.IE_NAME, message), expected=True) return media_data |