[cleanup] Fix minor mistakes (#17083)

Authored by: doe1080
This commit is contained in:
doe1080 2026-06-30 08:08:40 +09:00 committed by GitHub
parent 500e54cf86
commit b0472c3bce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 34 additions and 36 deletions

View File

@ -2001,7 +2001,7 @@ class YoutubeDL:
if webpage_url and webpage_url in self._playlist_urls:
self.to_screen(
'[download] Skipping already downloaded playlist: {}'.format(
ie_result.get('title')) or ie_result.get('id'))
ie_result.get('title') or ie_result.get('id')))
return
self._playlist_level += 1

View File

@ -99,7 +99,7 @@ class AllocineIE(InfoExtractor):
video_id = display_id
media_data = self._download_json(
f'http://www.allocine.fr/ws/AcVisiondataV5.ashx?media={video_id}', display_id)
title = remove_end(strip_or_none(self._html_extract_title(webpage), ' - AlloCiné'))
title = remove_end(strip_or_none(self._html_extract_title(webpage)), ' - AlloCiné')
for key, value in media_data['video'].items():
if not key.endswith('Path'):
continue

View File

@ -87,7 +87,7 @@ class AMPIE(InfoExtractor): # XXX: Conventionally, base classes should end with
'ext': ext,
})
timestamp = unified_timestamp(item.get('pubDate'), ' ') or parse_iso8601(item.get('dc-date'))
timestamp = unified_timestamp(item.get('pubDate')) or parse_iso8601(item.get('dc-date'))
return {
'id': video_id,

View File

@ -514,7 +514,10 @@ class BBCCoUkIE(InfoExtractor):
value = item.get(p)
if value and re.match(r'^[pb][\da-z]{7}$', value):
return value
get_from_attributes(item)
if programme_id := get_from_attributes(item):
return programme_id
mediator = item.find(f'./{{{self._EMP_PLAYLIST_NS}}}mediator')
if mediator is not None:
return get_from_attributes(mediator)

View File

@ -76,9 +76,9 @@ class BrainPOPBaseIE(InfoExtractor):
}, note='Logging in', errnote='Unable to log in', expected_status=400)
status_code = int_or_none(login_res['status_code'])
if status_code != 1505:
message = self._LOGIN_ERRORS.get(status_code) or login_res.get('message')
self.report_warning(
f'Unable to login: {self._LOGIN_ERRORS.get(status_code) or login_res.get("message")}'
or f'Got status code {status_code}')
f'Unable to login: {message}' if message else f'Got status code {status_code}')
class BrainPOPIE(BrainPOPBaseIE):

View File

@ -88,7 +88,7 @@ class BYUtvIE(InfoExtractor):
'url': video_url,
'format_id': format_id,
})
merge_dicts(info, {
info = merge_dicts(info, {
'title': ep.get('title'),
'description': ep.get('description'),
'thumbnail': ep.get('imageThumbnail'),

View File

@ -3070,8 +3070,8 @@ class InfoExtractor:
# %(...) counterparts to be used with % operator
t = re.sub(r'\$({})\$'.format('|'.join(identifiers)), r'%(\1)d', t)
t = re.sub(r'\$({})%([^$]+)\$'.format('|'.join(identifiers)), r'%(\1)\2', t)
t.replace('$$', '$')
return t
return t.replace('$$', '$')
# @initialization is a regular template like @media one
# so it should be handled just the same way (see

View File

@ -74,7 +74,7 @@ class HRTiBaseIE(InfoExtractor):
data=json.dumps(auth_data).encode())
except ExtractorError as e:
if isinstance(e.cause, HTTPError) and e.cause.status == 406:
auth_info = self._parse_json(e.cause.response.read().encode(), None)
auth_info = self._parse_json(e.cause.response.read().decode(), None)
else:
raise

View File

@ -457,12 +457,12 @@ class IqIE(InfoExtractor):
if video_format.get('m3u8Url'):
extracted_formats.extend(self._extract_m3u8_formats(
urljoin(format_data.get('dm3u8', 'https://cache-m.iq.com/dc/dt/'), video_format['m3u8Url']),
'mp4', m3u8_id=bid, fatal=False))
video_id, 'mp4', m3u8_id=bid, fatal=False))
if video_format.get('mpdUrl'):
# TODO: Properly extract mpd hostname
extracted_formats.extend(self._extract_mpd_formats(
urljoin(format_data.get('dm3u8', 'https://cache-m.iq.com/dc/dt/'), video_format['mpdUrl']),
mpd_id=bid, fatal=False))
video_id, mpd_id=bid, fatal=False))
if video_format.get('m3u8'):
ff = video_format.get('ff', 'ts')
if ff == 'ts':

View File

@ -69,7 +69,7 @@ class LibsynIE(InfoExtractor):
episode_title = data.get('item_title') or get_element_by_class('episode-title', webpage)
if not episode_title:
self._search_regex(
episode_title = self._search_regex(
[r'data-title="([^"]+)"', r'<title>(.+?)</title>'],
webpage, 'episode title')
episode_title = episode_title.strip()

View File

@ -59,7 +59,7 @@ class MirrativIE(MirrativBaseIE):
return {
'id': video_id,
'title': self._og_search_title(webpage, default=None) or self._search_regex(
r'<title>\s*(.+?) - Mirrativ\s*</title>', webpage) or live_response.get('title'),
r'<title>\s*(.+?) - Mirrativ\s*</title>', webpage, 'title', default=None) or live_response.get('title'),
'is_live': is_live,
'description': live_response.get('description'),
'formats': formats,

View File

@ -110,7 +110,7 @@ class NovaEmbedIE(InfoExtractor):
title = self._og_search_title(
webpage, default=None) or self._search_regex(
(r'<value>(?P<title>[^<]+)',
(r'<value>(?P<value>[^<]+)',
r'videoTitle\s*:\s*(["\'])(?P<value>(?:(?!\1).)+)\1'), webpage,
'title', group='value')
thumbnail = self._og_search_thumbnail(

View File

@ -74,7 +74,7 @@ class PandaTvIE(InfoExtractor):
'http_headers': http_headers,
**traverse_obj(video_meta, ('media', {
'title': ('title', {str}),
'release_timestamp': ('startTime', {parse_iso8601(delim=' ')}),
'release_timestamp': ('startTime', {parse_iso8601(delimiter=' ')}),
'thumbnail': ('ivsThumbnail', {url_or_none}),
'channel': ('userNick', {str}),
'concurrent_view_count': ('user', {int_or_none}),

View File

@ -107,11 +107,6 @@ class PeriscopeIE(PeriscopeBaseIE):
width = int_or_none(broadcast.get('width'))
height = int_or_none(broadcast.get('height'))
def add_width_and_height(f):
for key, val in (('width', width), ('height', height)):
if not f.get(key):
f[key] = val
video_urls = set()
formats = []
for format_id in ('replay', 'rtmp', 'hls', 'https_hls', 'lhls', 'lhlsweb'):
@ -128,7 +123,7 @@ class PeriscopeIE(PeriscopeBaseIE):
'url': video_url,
'ext': 'flv' if format_id == 'rtmp' else 'mp4',
}
self._add_width_and_height(rtmp_format)
self._add_width_and_height(rtmp_format, width, height)
formats.append(rtmp_format)
info['formats'] = formats

View File

@ -129,8 +129,8 @@ class RadioCanadaIE(InfoExtractor):
'thumbnail': get_meta('imageHR') or get_meta('imageMR') or get_meta('imageBR'),
'duration': int_or_none(get_meta('length')),
'series': get_meta('Emission'),
'season_number': int_or_none('SrcSaison'),
'episode_number': int_or_none('SrcEpisode'),
'season_number': int_or_none(get_meta('SrcSaison')),
'episode_number': int_or_none(get_meta('SrcEpisode')),
'upload_date': unified_strdate(get_meta('Date')),
'subtitles': subtitles,
'formats': formats,

View File

@ -298,7 +298,7 @@ class RCTIPlusSeriesIE(RCTIPlusBaseIE):
}
def _series_entries(self, series_id, display_id=None, video_type=None, metadata={}):
if not video_type or video_type in 'episodes':
if not video_type or video_type == 'episodes':
try:
seasons_list = self._call_api(
f'https://api.rctiplus.com/api/v1/program/{series_id}/season',
@ -311,11 +311,11 @@ class RCTIPlusSeriesIE(RCTIPlusBaseIE):
yield from self._entries(
f'https://api.rctiplus.com/api/v2/program/{series_id}/episode?season={season["season"]}',
display_id, f'Downloading season {season["season"]} episode entries', metadata)
if not video_type or video_type in 'extras':
if not video_type or video_type == 'extras':
yield from self._entries(
f'https://api.rctiplus.com/api/v2/program/{series_id}/extra?content_id=0',
display_id, 'Downloading extra entries', metadata)
if not video_type or video_type in 'clips':
if not video_type or video_type == 'clips':
yield from self._entries(
f'https://api.rctiplus.com/api/v2/program/{series_id}/clip?content_id=0',
display_id, 'Downloading clip entries', metadata)

View File

@ -48,7 +48,7 @@ class SaitosanIE(InfoExtractor):
self._download_webpage(base, b_id, note='Polling socket')
payload = f'420["room_start_join",{{"room_id":"{b_id}"}}]'
payload = f'{len(payload)}:{payload}'
payload = f'{len(payload)}:{payload}'.encode()
self._download_webpage(base, b_id, data=payload, note='Polling socket with payload')
response = self._download_socket_json(base, b_id, note='Polling socket')
@ -59,11 +59,11 @@ class SaitosanIE(InfoExtractor):
else 'The socket reported that the broadcast could not be joined. Maybe it\'s offline or the URL is incorrect',
expected=True, video_id=b_id)
self._download_webpage(base, b_id, data='26:421["room_finish_join",{}]', note='Polling socket')
self._download_webpage(base, b_id, data=b'26:421["room_finish_join",{}]', note='Polling socket')
b_data = self._download_socket_json(base, b_id, note='Getting broadcast metadata from socket')
m3u8_url = b_data.get('url')
self._download_webpage(base, b_id, data='1:1', note='Closing socket', fatal=False)
self._download_webpage(base, b_id, data=b'1:1', note='Closing socket', fatal=False)
return {
'id': b_id,

View File

@ -94,7 +94,7 @@ class SonyLIVIE(InfoExtractor):
'mobileNumber': username,
'channelPartnerID': 'MSMIND',
'country': 'IN',
'timestamp': dt.datetime.now().strftime('%Y-%m-%dT%H:%M:%S.%MZ'),
'timestamp': dt.datetime.now(dt.timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.%fZ'),
'otpSize': 6,
'loginType': 'REGISTERORSIGNIN',
'isMobileMandatory': True,
@ -111,7 +111,7 @@ class SonyLIVIE(InfoExtractor):
'otp': self._get_tfa_info('OTP'),
'dmaId': 'IN',
'ageConfirmation': True,
'timestamp': dt.datetime.now().strftime('%Y-%m-%dT%H:%M:%S.%MZ'),
'timestamp': dt.datetime.now(dt.timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.%fZ'),
'isMobileMandatory': True,
}).encode())
if otp_verify_json['resultCode'] == 'KO':

View File

@ -109,7 +109,7 @@ class SpankBangIE(InfoExtractor):
for mobj in re.finditer(
rf'{STREAM_URL_PREFIX}(?P<id>[^\s=]+)\s*=\s*(["\'])(?P<url>(?:(?!\2).)+)\2', webpage):
extract_format(mobj.group('id', 'url'))
extract_format(*mobj.group('id', 'url'))
if not formats:
stream_key = self._search_regex(

View File

@ -290,7 +290,7 @@ class TVPStreamIE(InfoExtractor):
def _real_extract(self, url):
channel_id = self._match_id(url)
channel_url = self._proto_relative_url(f'//stream.tvp.pl/?channel_id={channel_id}' or 'default')
channel_url = self._proto_relative_url(f'//stream.tvp.pl/?channel_id={channel_id}')
webpage = self._download_webpage(channel_url, channel_id or 'default', 'Downloading channel webpage')
channels = self._search_json(
r'window\.__channels\s*=', webpage, 'channel list', channel_id,

View File

@ -88,7 +88,7 @@ class WDRIE(InfoExtractor):
manifest_url, video_id, f4m_id='hds', fatal=False))
elif ext == 'smil':
formats.extend(self._extract_smil_formats(
medium_url, 'stream', fatal=False))
medium_url, video_id, fatal=False))
else:
a_format = {
'url': medium_url,