]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/atvat.py
[ie/bpb] Overhaul extractor (#8119)
[yt-dlp.git] / yt_dlp / extractor / atvat.py
index 7c30cfcbb9cee580a75a1e8286e89f6e5a9a21be..d6ed9e49586f5f02e64b0c20cdd5596b9a6a007d 100644 (file)
@@ -1,6 +1,3 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
 import datetime
 
 from .common import InfoExtractor
@@ -8,6 +5,7 @@
     float_or_none,
     jwt_encode_hs256,
     try_get,
+    ExtractorError,
 )
 
 
@@ -51,7 +49,6 @@ def _extract_video_info(self, url, content, video):
                     'url': source_url,
                     'format_id': protocol,
                 })
-        self._sort_formats(formats)
 
         return {
             'id': clip_id,
@@ -94,6 +91,11 @@ def _real_extract(self, url):
             })
 
         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 = [
             self._extract_video_info(url, contentResource[video['id']], video)
             for video in videos_data]