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,
float_or_none,
@ -27,14 +26,14 @@ class HitRecordIE(InfoExtractor):
'like_count': int,
'comment_count': int,
'tags': list,
}
},
}
def _real_extract(self, url):
video_id = self._match_id(url)
video = self._download_json(
'https://hitrecord.org/api/web/records/%s' % video_id, video_id)
f'https://hitrecord.org/api/web/records/{video_id}', video_id)
title = video['title']
video_url = video['source_url']['mp4_url']
@ -46,7 +45,7 @@ class HitRecordIE(InfoExtractor):
t['text']
for t in tags_list
if isinstance(t, dict) and t.get('text')
and isinstance(t['text'], compat_str)]
and isinstance(t['text'], str)]
return {
'id': video_id,
@ -56,9 +55,9 @@ class HitRecordIE(InfoExtractor):
'duration': float_or_none(video.get('duration'), 1000),
'timestamp': int_or_none(video.get('created_at_i')),
'uploader': try_get(
video, lambda x: x['user']['username'], compat_str),
video, lambda x: x['user']['username'], str),
'uploader_id': try_get(
video, lambda x: compat_str(x['user']['id'])),
video, lambda x: str(x['user']['id'])),
'view_count': int_or_none(video.get('total_views_count')),
'like_count': int_or_none(video.get('hearts_count')),
'comment_count': int_or_none(video.get('comments_count')),