]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/skynewsarabia.py
[cleanup] Add more ruff rules (#10149)
[yt-dlp.git] / yt_dlp / extractor / skynewsarabia.py
index 234703cf705bcafcc06f1ff461c7585a570a35b3..7ac24437f7a27aad01eefa8bf534033e4366be92 100644 (file)
@@ -1,5 +1,4 @@
 from .common import InfoExtractor
-from ..compat import compat_str
 from ..utils import (
     parse_duration,
     parse_iso8601,
@@ -10,7 +9,7 @@ class SkyNewsArabiaBaseIE(InfoExtractor):
     _IMAGE_BASE_URL = 'http://www.skynewsarabia.com/web/images'
 
     def _call_api(self, path, value):
-        return self._download_json('http://api.skynewsarabia.com/web/rest/v2/%s/%s.json' % (path, value), value)
+        return self._download_json(f'http://api.skynewsarabia.com/web/rest/v2/{path}/{value}.json', value)
 
     def _get_limelight_media_id(self, url):
         return self._search_regex(r'/media/[^/]+/([a-z0-9]{32})', url, 'limelight media id')
@@ -19,11 +18,11 @@ def _get_image_url(self, image_path_template, width='1600', height='1200'):
         return self._IMAGE_BASE_URL + image_path_template.format(width=width, height=height)
 
     def _extract_video_info(self, video_data):
-        video_id = compat_str(video_data['id'])
+        video_id = str(video_data['id'])
         topic = video_data.get('topicTitle')
         return {
             '_type': 'url_transparent',
-            'url': 'limelight:media:%s' % self._get_limelight_media_id(video_data['videoUrl'][0]['url']),
+            'url': 'limelight:media:{}'.format(self._get_limelight_media_id(video_data['videoUrl'][0]['url'])),
             'id': video_id,
             'title': video_data['headline'],
             'description': video_data.get('summary'),
@@ -32,7 +31,7 @@ def _extract_video_info(self, video_data):
             'duration': parse_duration(video_data.get('runTime')),
             'tags': video_data.get('tags', []),
             'categories': [topic] if topic else [],
-            'webpage_url': 'http://www.skynewsarabia.com/web/video/%s' % video_id,
+            'webpage_url': f'http://www.skynewsarabia.com/web/video/{video_id}',
             'ie_key': 'LimelightMedia',
         }
 
@@ -101,7 +100,7 @@ def _real_extract(self, url):
             topic = article_data.get('topicTitle')
             return {
                 '_type': 'url_transparent',
-                'url': 'limelight:media:%s' % self._get_limelight_media_id(media_asset['videoUrl'][0]['url']),
+                'url': 'limelight:media:{}'.format(self._get_limelight_media_id(media_asset['videoUrl'][0]['url'])),
                 'id': article_id,
                 'title': article_data['headline'],
                 'description': article_data.get('summary'),