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,7 +1,7 @@
import re
import urllib.parse
from .common import InfoExtractor
from ..compat import compat_parse_qs
from ..networking import Request
from ..utils import (
ExtractorError,
@ -92,7 +92,7 @@ class FC2IE(InfoExtractor):
description = self._og_search_description(webpage, default=None)
vidplaylist = self._download_json(
'https://video.fc2.com/api/v3/videoplaylist/%s?sh=1&fs=0' % video_id, video_id,
f'https://video.fc2.com/api/v3/videoplaylist/{video_id}?sh=1&fs=0', video_id,
note='Downloading info page')
vid_url = traverse_obj(vidplaylist, ('playlist', 'nq'))
if not vid_url:
@ -127,22 +127,22 @@ class FC2EmbedIE(InfoExtractor):
def _real_extract(self, url):
mobj = self._match_valid_url(url)
query = compat_parse_qs(mobj.group('query'))
query = urllib.parse.parse_qs(mobj.group('query'))
video_id = query['i'][-1]
title = query.get('tl', ['FC2 video %s' % video_id])[0]
title = query.get('tl', [f'FC2 video {video_id}'])[0]
sj = query.get('sj', [None])[0]
thumbnail = None
if sj:
# See thumbnailImagePath() in ServerConst.as of flv2.swf
thumbnail = 'http://video%s-thumbnail.fc2.com/up/pic/%s.jpg' % (
thumbnail = 'http://video{}-thumbnail.fc2.com/up/pic/{}.jpg'.format(
sj, '/'.join((video_id[:6], video_id[6:8], video_id[-2], video_id[-1], video_id)))
return {
'_type': 'url_transparent',
'ie_key': FC2IE.ie_key(),
'url': 'fc2:%s' % video_id,
'url': f'fc2:{video_id}',
'title': title,
'thumbnail': thumbnail,
}
@ -166,7 +166,7 @@ class FC2LiveIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage('https://live.fc2.com/%s/' % video_id, video_id)
webpage = self._download_webpage(f'https://live.fc2.com/{video_id}/', video_id)
self._set_cookie('live.fc2.com', 'js-player_size', '1')
@ -175,7 +175,7 @@ class FC2LiveIE(InfoExtractor):
'channel': '1',
'profile': '1',
'user': '1',
'streamid': video_id
'streamid': video_id,
}), note='Requesting member info')
control_server = self._download_json(
@ -224,7 +224,7 @@ class FC2LiveIE(InfoExtractor):
self.write_debug('Goodbye')
playlist_data = data
break
self.write_debug('Server said: %s%s' % (recv[:100], '...' if len(recv) > 100 else ''))
self.write_debug('Server said: {}{}'.format(recv[:100], '...' if len(recv) > 100 else ''))
if not playlist_data:
raise ExtractorError('Unable to fetch HLS playlist info via WebSocket')