aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2019-11-16 01:51:31 +0100
committerRemita Amine <remitamine@gmail.com>2019-11-16 01:51:48 +0100
commit9e4e864639bf606a1931a684f130e219e869adfd (patch)
tree34eabebe7eb2450607d9859ca1a0b361fcebccab
parent6c79785bb0c96d6fc22d942946196f0842d70a93 (diff)
downloadyoutube-dl-9e4e864639bf606a1931a684f130e219e869adfd.tar.xz
[ivi] improve error detection
-rw-r--r--youtube_dl/extractor/ivi.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/youtube_dl/extractor/ivi.py b/youtube_dl/extractor/ivi.py
index 1dcb17c9b..7f1146d95 100644
--- a/youtube_dl/extractor/ivi.py
+++ b/youtube_dl/extractor/ivi.py
@@ -119,17 +119,20 @@ class IviIE(InfoExtractor):
error = video_json.get('error')
if error:
- origin = error['origin']
+ origin = error.get('origin')
+ message = error.get('message') or error.get('user_message')
+ extractor_msg = 'Unable to download video %s'
if origin == 'NotAllowedForLocation':
- self.raise_geo_restricted(
- msg=error['message'], countries=self._GEO_COUNTRIES)
+ self.raise_geo_restricted(message, self._GEO_COUNTRIES)
elif origin == 'NoRedisValidData':
- raise ExtractorError('Video %s does not exist' % video_id, expected=True)
- elif origin == 'NotAllowedError':
- raise ExtractorError('pycryptodome not found. Please install it.', expected=True)
- raise ExtractorError(
- 'Unable to download video %s: %s' % (video_id, error['message']),
- expected=True)
+ extractor_msg = 'Video %s does not exist'
+ elif message:
+ if 'недоступен для просмотра на площадке s183' in message:
+ raise ExtractorError(
+ 'pycryptodome not found. Please install it.',
+ expected=True)
+ extractor_msg += ': ' + message
+ raise ExtractorError(extractor_msg % video_id, expected=True)
result = video_json['result']
title = result['title']