]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/dplay.py
[cleanup] Add more ruff rules (#10149)
[yt-dlp.git] / yt_dlp / extractor / dplay.py
index ddf2128b0a434fff9155ca78df3a6f159a445ce5..48eae1088b4a25da7bb682ce4bc56785e01ae5de 100644 (file)
@@ -70,7 +70,7 @@ def _get_disco_api_info(self, url, display_id, disco_host, realm, country, domai
         self._initialize_geo_bypass({
             'countries': geo_countries,
         })
-        disco_base = 'https://%s/' % disco_host
+        disco_base = f'https://{disco_host}/'
         headers = {
             'Referer': url,
         }
@@ -84,7 +84,7 @@ def _get_disco_api_info(self, url, display_id, disco_host, realm, country, domai
                     'fields[show]': 'name',
                     'fields[tag]': 'name',
                     'fields[video]': 'description,episodeNumber,name,publishStart,seasonNumber,videoDuration',
-                    'include': 'images,primaryChannel,show,tags'
+                    'include': 'images,primaryChannel,show,tags',
                 })
         except ExtractorError as e:
             if isinstance(e.cause, HTTPError) and e.cause.status == 400:
@@ -359,7 +359,7 @@ def _download_video_playback_info(self, disco_base, video_id, headers):
                 },
                 'videoId': video_id,
                 'wisteriaProperties': {},
-            }).encode('utf-8'))['data']['attributes']['streaming']
+            }).encode())['data']['attributes']['streaming']
 
     def _real_extract(self, url):
         return self._get_disco_api_info(url, self._match_id(url), **self._DISCO_API_PARAMS)
@@ -857,7 +857,7 @@ class DiscoveryPlusIndiaIE(DiscoveryPlusBaseIE):
         },
         'params': {
             'skip_download': True,
-        }
+        },
     }]
 
     _PRODUCT = 'dplus-india'
@@ -870,7 +870,7 @@ class DiscoveryPlusIndiaIE(DiscoveryPlusBaseIE):
 
     def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
         headers.update({
-            'x-disco-params': 'realm=%s' % realm,
+            'x-disco-params': f'realm={realm}',
             'x-disco-client': f'WEB:UNKNOWN:{self._PRODUCT}:17.0.0',
             'Authorization': self._get_auth(disco_base, display_id, realm),
         })
@@ -967,14 +967,14 @@ def _entries(self, show_name):
             while page_num < total_pages:
                 season_json = self._download_json(
                     season_url.format(season_id, show_id, str(page_num + 1)), show_name, headers=headers,
-                    note='Downloading season %s JSON metadata%s' % (season_id, ' page %d' % page_num if page_num else ''))
+                    note='Downloading season {} JSON metadata{}'.format(season_id, f' page {page_num}' if page_num else ''))
                 if page_num == 0:
                     total_pages = try_get(season_json, lambda x: x['meta']['totalPages'], int) or 1
                 episodes_json = season_json['data']
                 for episode in episodes_json:
                     video_path = episode['attributes']['path']
                     yield self.url_result(
-                        '%svideos/%s' % (self._DOMAIN, video_path),
+                        f'{self._DOMAIN}videos/{video_path}',
                         ie=self._VIDEO_IE.ie_key(), video_id=episode.get('id') or video_path)
                 page_num += 1
 
@@ -1002,7 +1002,7 @@ class DiscoveryPlusItalyIE(DiscoveryPlusBaseIE):
 
     def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
         headers.update({
-            'x-disco-params': 'realm=%s' % realm,
+            'x-disco-params': f'realm={realm}',
             'x-disco-client': f'WEB:UNKNOWN:{self._PRODUCT}:25.2.6',
             'Authorization': self._get_auth(disco_base, display_id, realm),
         })