diff options
| author | Sergey M․ <dstftw@gmail.com> | 2017-02-24 10:52:41 +0700 | 
|---|---|---|
| committer | Sergey M․ <dstftw@gmail.com> | 2017-02-24 10:54:39 +0700 | 
| commit | 42dcdbe11cd738e6b196bc9c14b746a71d61de5c (patch) | |
| tree | 60b0c6cc125e349e6e1172dc6f8b6eba81ca43dd | |
| parent | 6b097cff278c93de0665bf681729d75121a98eed (diff) | |
[ivi] Raise GeoRestrictedError
| -rw-r--r-- | youtube_dl/extractor/ivi.py | 8 | 
1 files changed, 7 insertions, 1 deletions
| diff --git a/youtube_dl/extractor/ivi.py b/youtube_dl/extractor/ivi.py index 3d3c15024..cb51cef2d 100644 --- a/youtube_dl/extractor/ivi.py +++ b/youtube_dl/extractor/ivi.py @@ -16,6 +16,8 @@ class IviIE(InfoExtractor):      IE_DESC = 'ivi.ru'      IE_NAME = 'ivi'      _VALID_URL = r'https?://(?:www\.)?ivi\.ru/(?:watch/(?:[^/]+/)?|video/player\?.*?videoId=)(?P<id>\d+)' +    _GEO_BYPASS = False +    _GEO_COUNTRIES = ['RU']      _TESTS = [          # Single movie @@ -91,7 +93,11 @@ class IviIE(InfoExtractor):          if 'error' in video_json:              error = video_json['error'] -            if error['origin'] == 'NoRedisValidData': +            origin = error['origin'] +            if origin == 'NotAllowedForLocation': +                self.raise_geo_restricted( +                    msg=error['message'], countries=self._GEO_COUNTRIES) +            elif origin == 'NoRedisValidData':                  raise ExtractorError('Video %s does not exist' % video_id, expected=True)              raise ExtractorError(                  'Unable to download video %s: %s' % (video_id, error['message']), | 
