1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-09-03 00:25:08 +00:00

[cleanup] Add more ruff rules (#10149)

Authored by: seproDev

Reviewed-by: bashonly <88596187+bashonly@users.noreply.github.com>
Reviewed-by: Simon Sawicki <contact@grub4k.xyz>
This commit is contained in:
sepro
2024-06-12 01:09:58 +02:00
committed by GitHub
parent db50f19d76
commit add96eb9f8
915 changed files with 7027 additions and 7246 deletions

View File

@ -1,5 +1,4 @@
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
clean_html,
format_field,
@ -16,7 +15,7 @@ class MindsBaseIE(InfoExtractor):
api_url = 'https://www.minds.com/api/' + path
token = self._get_cookies(api_url).get('XSRF-TOKEN')
return self._download_json(
api_url, video_id, 'Downloading %s JSON metadata' % resource, headers={
api_url, video_id, f'Downloading {resource} JSON metadata', headers={
'Referer': 'https://www.minds.com/',
'X-XSRF-TOKEN': token.value if token else '',
}, query=query)
@ -98,7 +97,7 @@ class MindsIE(MindsBaseIE):
uploader_id = owner.get('username')
tags = entity.get('tags')
if tags and isinstance(tags, compat_str):
if tags and isinstance(tags, str):
tags = [tags]
thumbnail = None
@ -135,8 +134,8 @@ class MindsFeedBaseIE(MindsBaseIE):
i = 1
while True:
data = self._call_api(
'v2/feeds/container/%s/videos' % feed_id,
feed_id, 'page %s' % i, query)
f'v2/feeds/container/{feed_id}/videos',
feed_id, f'page {i}', query)
entities = data.get('entities') or []
for entity in entities:
guid = entity.get('guid')
@ -153,7 +152,7 @@ class MindsFeedBaseIE(MindsBaseIE):
def _real_extract(self, url):
feed_id = self._match_id(url)
feed = self._call_api(
'v1/%s/%s' % (self._FEED_PATH, feed_id),
f'v1/{self._FEED_PATH}/{feed_id}',
feed_id, self._FEED_TYPE)[self._FEED_TYPE]
return self.playlist_result(