]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/webofstories.py
[cleanup] Add more ruff rules (#10149)
[yt-dlp.git] / yt_dlp / extractor / webofstories.py
index 65f48f3b1931478982d00f63a5878c60bf3f05da..24befe7cdbdd28ef56035483f0a489aedef6302c 100644 (file)
@@ -22,7 +22,7 @@ class WebOfStoriesIE(InfoExtractor):
             'thumbnail': r're:^https?://.*\.jpg$',
             'description': 'Hans Bethe talks about calculating the temperature of the sun',
             'duration': 238,
-        }
+        },
     }, {
         'url': 'http://www.webofstories.com/play/55908',
         'md5': '2985a698e1fe3211022422c4b5ed962c',
@@ -79,19 +79,15 @@ def _real_extract(self, url):
             ms_prefix = 'mini_sites/'
 
         if is_great_life_series:
-            mp4_url = '{0:}lives/{1:}/{2:}.mp4'.format(
-                self._VIDEO_DOMAIN, speaker_id, story_filename)
+            mp4_url = f'{self._VIDEO_DOMAIN}lives/{speaker_id}/{story_filename}.mp4'
             rtmp_ext = 'flv'
             streamer = self._GREAT_LIFE_STREAMER
-            play_path = 'stories/{0:}/{1:}'.format(
-                speaker_id, story_filename)
+            play_path = f'stories/{speaker_id}/{story_filename}'
         else:
-            mp4_url = '{0:}{1:}{2:}/{3:}.mp4'.format(
-                self._VIDEO_DOMAIN, ms_prefix, speaker_id, story_filename)
+            mp4_url = f'{self._VIDEO_DOMAIN}{ms_prefix}{speaker_id}/{story_filename}.mp4'
             rtmp_ext = 'mp4'
             streamer = self._USER_STREAMER
-            play_path = 'mp4:{0:}{1:}/{2}.mp4'.format(
-                ms_prefix, speaker_id, story_filename)
+            play_path = f'mp4:{ms_prefix}{speaker_id}/{story_filename}.mp4'
 
         formats = [{
             'format_id': 'mp4_sd',
@@ -132,7 +128,7 @@ def _real_extract(self, url):
 
         entries = [
             self.url_result(
-                'http://www.webofstories.com/play/%s' % video_id,
+                f'http://www.webofstories.com/play/{video_id}',
                 'WebOfStories', video_id=video_id)
             for video_id in orderedSet(re.findall(r'\bid=["\']td_(\d+)', webpage))
         ]
@@ -145,7 +141,7 @@ def _real_extract(self, url):
                 r'<span id="primaryField">([^<]+)</span>',
                 webpage, 'field', default=None)
             if field:
-                title += ' (%s)' % field
+                title += f' ({field})'
 
         if not title:
             title = self._search_regex(