mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-11-14 05:25:12 +00:00
@@ -740,7 +740,7 @@ class YoutubeWebArchiveIE(InfoExtractor):
|
||||
note or 'Downloading CDX API JSON', query=query, fatal=fatal)
|
||||
if isinstance(res, list) and len(res) >= 2:
|
||||
# format response to make it easier to use
|
||||
return [dict(zip(res[0], v)) for v in res[1:]]
|
||||
return [dict(zip(res[0], v)) for v in res[1:]] # noqa: B905
|
||||
elif not isinstance(res, list) or len(res) != 0:
|
||||
self.report_warning('Error while parsing CDX API response' + bug_reports_message())
|
||||
|
||||
|
||||
@@ -1663,7 +1663,7 @@ class InfoExtractor:
|
||||
'end_time': part.get('endOffset'),
|
||||
} for part in variadic(e.get('hasPart') or []) if part.get('@type') == 'Clip']
|
||||
for idx, (last_c, current_c, next_c) in enumerate(zip(
|
||||
[{'end_time': 0}, *chapters], chapters, chapters[1:])):
|
||||
[{'end_time': 0}, *chapters], chapters, chapters[1:], strict=False)):
|
||||
current_c['end_time'] = current_c['end_time'] or next_c['start_time']
|
||||
current_c['start_time'] = current_c['start_time'] or last_c['end_time']
|
||||
if None in current_c.values():
|
||||
@@ -1848,7 +1848,7 @@ class InfoExtractor:
|
||||
return {}
|
||||
|
||||
args = dict(zip(arg_keys.split(','), map(json.dumps, self._parse_json(
|
||||
f'[{arg_vals}]', video_id, transform_source=js_to_json, fatal=fatal) or ())))
|
||||
f'[{arg_vals}]', video_id, transform_source=js_to_json, fatal=fatal) or ()), strict=True))
|
||||
|
||||
ret = self._parse_json(js, video_id, transform_source=functools.partial(js_to_json, vars=args), fatal=fatal)
|
||||
return traverse_obj(ret, traverse) or {}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import json
|
||||
import socket
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..utils import (
|
||||
@@ -56,7 +55,7 @@ class DTubeIE(InfoExtractor):
|
||||
try:
|
||||
self.to_screen(f'{video_id}: Checking {format_id} video format URL')
|
||||
self._downloader._opener.open(video_url, timeout=5).close()
|
||||
except socket.timeout:
|
||||
except TimeoutError:
|
||||
self.to_screen(
|
||||
f'{video_id}: {format_id} URL is invalid, skipping')
|
||||
continue
|
||||
|
||||
@@ -56,7 +56,7 @@ class FujiTVFODPlus7IE(InfoExtractor):
|
||||
fmt, subs = self._extract_m3u8_formats_and_subtitles(src['url'], video_id, 'ts')
|
||||
for f in fmt:
|
||||
f.update(dict(zip(('height', 'width'),
|
||||
self._BITRATE_MAP.get(f.get('tbr'), ()))))
|
||||
self._BITRATE_MAP.get(f.get('tbr'), ()), strict=False)))
|
||||
formats.extend(fmt)
|
||||
subtitles = self._merge_subtitles(subtitles, subs)
|
||||
|
||||
|
||||
@@ -437,7 +437,7 @@ class KalturaIE(InfoExtractor):
|
||||
params = urllib.parse.parse_qs(query)
|
||||
if path:
|
||||
splitted_path = path.split('/')
|
||||
params.update(dict(zip(splitted_path[::2], [[v] for v in splitted_path[1::2]])))
|
||||
params.update(dict(zip(splitted_path[::2], [[v] for v in splitted_path[1::2]]))) # noqa: B905
|
||||
if 'wid' in params:
|
||||
partner_id = remove_start(params['wid'][0], '_')
|
||||
elif 'p' in params:
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import itertools
|
||||
import re
|
||||
import urllib.parse
|
||||
|
||||
@@ -216,7 +217,7 @@ class LyndaIE(LyndaBaseIE):
|
||||
def _fix_subtitles(self, subs):
|
||||
srt = ''
|
||||
seq_counter = 0
|
||||
for seq_current, seq_next in zip(subs, subs[1:]):
|
||||
for seq_current, seq_next in itertools.pairwise(subs):
|
||||
m_current = re.match(self._TIMECODE_REGEX, seq_current['Timecode'])
|
||||
if m_current is None:
|
||||
continue
|
||||
|
||||
@@ -92,7 +92,7 @@ class MojevideoIE(InfoExtractor):
|
||||
contains_pattern=r'\[(?s:.+)\]', transform_source=js_to_json)
|
||||
|
||||
formats = []
|
||||
for video_hash, (suffix, quality, format_note) in zip(video_hashes, [
|
||||
for video_hash, (suffix, quality, format_note) in zip(video_hashes, [ # noqa: B905
|
||||
('', 1, 'normálna kvalita'),
|
||||
('_lq', 0, 'nízka kvalita'),
|
||||
('_hd', 2, 'HD-720p'),
|
||||
|
||||
@@ -503,7 +503,7 @@ class NhkForSchoolBangumiIE(InfoExtractor):
|
||||
'start_time': s,
|
||||
'end_time': e,
|
||||
'title': t,
|
||||
} for s, e, t in zip(start_time, end_time, chapter_titles)]
|
||||
} for s, e, t in zip(start_time, end_time, chapter_titles, strict=True)]
|
||||
|
||||
return {
|
||||
'id': video_id,
|
||||
|
||||
@@ -181,7 +181,7 @@ class PBSIE(InfoExtractor):
|
||||
)
|
||||
|
||||
IE_NAME = 'pbs'
|
||||
IE_DESC = 'Public Broadcasting Service (PBS) and member stations: {}'.format(', '.join(list(zip(*_STATIONS))[1]))
|
||||
IE_DESC = 'Public Broadcasting Service (PBS) and member stations: {}'.format(', '.join(list(zip(*_STATIONS, strict=True))[1]))
|
||||
|
||||
_VALID_URL = r'''(?x)https?://
|
||||
(?:
|
||||
@@ -193,7 +193,7 @@ class PBSIE(InfoExtractor):
|
||||
(?:[^/?#]+/){{1,5}}(?P<presumptive_id>[^/?#]+?)(?:\.html)?/?(?:$|[?#])
|
||||
)
|
||||
)
|
||||
'''.format('|'.join(next(zip(*_STATIONS))))
|
||||
'''.format('|'.join(next(zip(*_STATIONS, strict=True))))
|
||||
|
||||
_GEO_COUNTRIES = ['US']
|
||||
|
||||
|
||||
@@ -405,7 +405,7 @@ class PolskieRadioCategoryIE(InfoExtractor):
|
||||
tab_content = self._download_json(
|
||||
'https://www.polskieradio.pl/CMS/TemplateBoxesManagement/TemplateBoxTabContent.aspx/GetTabContent',
|
||||
category_id, f'Downloading page {page_num}', headers={'content-type': 'application/json'},
|
||||
data=json.dumps(dict(zip((
|
||||
data=json.dumps(dict(zip(( # noqa: B905
|
||||
'boxInstanceId', 'tabId', 'categoryType', 'sectionId', 'categoryId', 'pagerMode',
|
||||
'subjectIds', 'tagIndexId', 'queryString', 'name', 'openArticlesInParentTemplate',
|
||||
'idSectionFromUrl', 'maxDocumentAge', 'showCategoryForArticle', 'pageNumber',
|
||||
|
||||
@@ -155,7 +155,7 @@ class Pr0grammIE(InfoExtractor):
|
||||
# Sorted by "confidence", higher confidence = earlier in list
|
||||
confidences = traverse_obj(metadata, ('tags', ..., 'confidence', ({int}, {float})))
|
||||
if confidences:
|
||||
tags = [tag for _, tag in sorted(zip(confidences, tags), reverse=True)]
|
||||
tags = [tag for _, tag in sorted(zip(confidences, tags), reverse=True)] # noqa: B905
|
||||
|
||||
formats = traverse_obj(video_info, ('variants', ..., {
|
||||
'format_id': ('name', {str}),
|
||||
|
||||
@@ -81,7 +81,7 @@ class TikTokBaseIE(InfoExtractor):
|
||||
}
|
||||
self._APP_INFO_POOL = [
|
||||
{**defaults, **dict(
|
||||
(k, v) for k, v in zip(self._APP_INFO_DEFAULTS, app_info.split('/')) if v
|
||||
(k, v) for k, v in zip(self._APP_INFO_DEFAULTS, app_info.split('/'), strict=False) if v
|
||||
)} for app_info in self._KNOWN_APP_INFO
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user