]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/lego.py
[ie/matchtv] Fix extractor (#10190)
[yt-dlp.git] / yt_dlp / extractor / lego.py
index 811b44758786a2fdd8cd5f82c010150f5449683b..5a98cc7497a9a6461476150e5f7d674ff2a066f6 100644 (file)
@@ -1,7 +1,7 @@
 import uuid
 
 from .common import InfoExtractor
-from ..compat import compat_HTTPError
+from ..networking.exceptions import HTTPError
 from ..utils import (
     ExtractorError,
     int_or_none,
@@ -72,10 +72,10 @@ def _real_extract(self, url):
                 # https://contentfeed.services.lego.com/api/v2/item/[VIDEO_ID]?culture=[LOCALE]&contentType=Video
                 'https://services.slingshot.lego.com/mediaplayer/v2',
                 video_id, query={
-                    'videoId': '%s_%s' % (uuid.UUID(video_id), locale),
+                    'videoId': f'{uuid.UUID(video_id)}_{locale}',
                 }, headers=self.geo_verification_headers())
         except ExtractorError as e:
-            if isinstance(e.cause, compat_HTTPError) and e.cause.code == 451:
+            if isinstance(e.cause, HTTPError) and e.cause.status == 451:
                 self.raise_geo_restricted(countries=countries)
             raise
 
@@ -111,7 +111,7 @@ def _real_extract(self, url):
                         'abr': quality[0],
                         'height': quality[1],
                         'width': quality[2],
-                    }),
+                    })
                 formats.append(f)
 
         subtitles = {}
@@ -123,7 +123,7 @@ def _real_extract(self, url):
             video_version = video.get('VideoVersion')
             if net_storage_path and invariant_id and video_file_id and video_version:
                 subtitles.setdefault(locale[:2], []).append({
-                    'url': 'https://lc-mediaplayerns-live-s.legocdn.com/public/%s/%s_%s_%s_%s_sub.srt' % (net_storage_path, invariant_id, video_file_id, locale, video_version),
+                    'url': f'https://lc-mediaplayerns-live-s.legocdn.com/public/{net_storage_path}/{invariant_id}_{video_file_id}_{locale}_{video_version}_sub.srt',
                 })
 
         return {