mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-26 02:55:17 +00:00
[ivi] Raise GeoRestrictedError
This commit is contained in:
parent
6b097cff27
commit
42dcdbe11c
1 changed files with 7 additions and 1 deletions
|
@ -16,6 +16,8 @@ class IviIE(InfoExtractor):
|
||||||
IE_DESC = 'ivi.ru'
|
IE_DESC = 'ivi.ru'
|
||||||
IE_NAME = 'ivi'
|
IE_NAME = 'ivi'
|
||||||
_VALID_URL = r'https?://(?:www\.)?ivi\.ru/(?:watch/(?:[^/]+/)?|video/player\?.*?videoId=)(?P<id>\d+)'
|
_VALID_URL = r'https?://(?:www\.)?ivi\.ru/(?:watch/(?:[^/]+/)?|video/player\?.*?videoId=)(?P<id>\d+)'
|
||||||
|
_GEO_BYPASS = False
|
||||||
|
_GEO_COUNTRIES = ['RU']
|
||||||
|
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
# Single movie
|
# Single movie
|
||||||
|
@ -91,7 +93,11 @@ def _real_extract(self, url):
|
||||||
|
|
||||||
if 'error' in video_json:
|
if 'error' in video_json:
|
||||||
error = video_json['error']
|
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('Video %s does not exist' % video_id, expected=True)
|
||||||
raise ExtractorError(
|
raise ExtractorError(
|
||||||
'Unable to download video %s: %s' % (video_id, error['message']),
|
'Unable to download video %s: %s' % (video_id, error['message']),
|
||||||
|
|
Loading…
Reference in a new issue