mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-09-04 00:55:15 +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:
@ -1,7 +1,6 @@
|
||||
import re
|
||||
|
||||
from .srgssr import SRGSSRIE
|
||||
from ..compat import compat_str
|
||||
from ..utils import (
|
||||
determine_ext,
|
||||
int_or_none,
|
||||
@ -110,7 +109,7 @@ class RTSIE(SRGSSRIE): # XXX: Do not subclass from concrete IE
|
||||
{
|
||||
'url': 'http://pages.rts.ch/emissions/passe-moi-les-jumelles/5624065-entre-ciel-et-mer.html',
|
||||
'only_matching': True,
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
def _real_extract(self, url):
|
||||
@ -120,7 +119,7 @@ class RTSIE(SRGSSRIE): # XXX: Do not subclass from concrete IE
|
||||
|
||||
def download_json(internal_id):
|
||||
return self._download_json(
|
||||
'http://www.rts.ch/a/%s.html?f=json/article' % internal_id,
|
||||
f'http://www.rts.ch/a/{internal_id}.html?f=json/article',
|
||||
display_id)
|
||||
|
||||
all_info = download_json(media_id)
|
||||
@ -149,7 +148,7 @@ class RTSIE(SRGSSRIE): # XXX: Do not subclass from concrete IE
|
||||
r'(?s)<iframe[^>]+class="srg-player"[^>]+src="[^"]+urn:([^"]+)"',
|
||||
page)
|
||||
if videos:
|
||||
entries = [self.url_result('srgssr:%s' % video_urn, 'SRGSSR') for video_urn in videos]
|
||||
entries = [self.url_result(f'srgssr:{video_urn}', 'SRGSSR') for video_urn in videos]
|
||||
|
||||
if entries:
|
||||
return self.playlist_result(entries, media_id, all_info.get('title'))
|
||||
@ -196,7 +195,7 @@ class RTSIE(SRGSSRIE): # XXX: Do not subclass from concrete IE
|
||||
'tbr': extract_bitrate(format_url),
|
||||
})
|
||||
|
||||
download_base = 'http://rtsww%s-d.rts.ch/' % ('-a' if media_type == 'audio' else '')
|
||||
download_base = 'http://rtsww{}-d.rts.ch/'.format('-a' if media_type == 'audio' else '')
|
||||
for media in info.get('media', []):
|
||||
media_url = media.get('url')
|
||||
if not media_url or re.match(r'https?://', media_url):
|
||||
@ -215,7 +214,7 @@ class RTSIE(SRGSSRIE): # XXX: Do not subclass from concrete IE
|
||||
self._check_formats(formats, media_id)
|
||||
|
||||
duration = info.get('duration') or info.get('cutout') or info.get('cutduration')
|
||||
if isinstance(duration, compat_str):
|
||||
if isinstance(duration, str):
|
||||
duration = parse_duration(duration)
|
||||
|
||||
return {
|
||||
|
Reference in New Issue
Block a user