[ATVAt] Detect geo-restriction (#2777)

Authored by: marieell
This commit is contained in:
marieell 2022-02-15 10:16:49 +01:00 committed by GitHub
parent c2a8547fdc
commit 5c6dfc1f79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@
float_or_none, float_or_none,
jwt_encode_hs256, jwt_encode_hs256,
try_get, try_get,
ExtractorError,
) )
@ -94,6 +95,11 @@ def _real_extract(self, url):
}) })
video_id, videos_data = list(videos['data'].items())[0] video_id, videos_data = list(videos['data'].items())[0]
error_msg = try_get(videos_data, lambda x: x['error']['title'])
if error_msg == 'Geo check failed':
self.raise_geo_restricted(error_msg)
elif error_msg:
raise ExtractorError(error_msg)
entries = [ entries = [
self._extract_video_info(url, contentResource[video['id']], video) self._extract_video_info(url, contentResource[video['id']], video)
for video in videos_data] for video in videos_data]