aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp
diff options
context:
space:
mode:
Diffstat (limited to 'yt_dlp')
-rw-r--r--yt_dlp/YoutubeDL.py1
-rw-r--r--yt_dlp/__init__.py2
-rw-r--r--yt_dlp/extractor/bilibili.py2
-rw-r--r--yt_dlp/extractor/common.py6
-rw-r--r--yt_dlp/extractor/crunchyroll.py2
-rw-r--r--yt_dlp/extractor/yandexvideo.py4
-rw-r--r--yt_dlp/extractor/youtube.py4
-rw-r--r--yt_dlp/options.py8
-rw-r--r--yt_dlp/postprocessor/ffmpeg.py6
-rw-r--r--yt_dlp/utils.py2
10 files changed, 20 insertions, 17 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index 7dc88e8a6..37964169f 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -3392,6 +3392,7 @@ class YoutubeDL:
reject = lambda k, v: v is None or k.startswith('__') or k in {
'requested_downloads', 'requested_formats', 'requested_subtitles', 'requested_entries',
'entries', 'filepath', '_filename', 'infojson_filename', 'original_url', 'playlist_autonumber',
+ '_format_sort_fields',
}
else:
reject = lambda k, v: False
diff --git a/yt_dlp/__init__.py b/yt_dlp/__init__.py
index 2e35db1ba..df1a54138 100644
--- a/yt_dlp/__init__.py
+++ b/yt_dlp/__init__.py
@@ -332,7 +332,7 @@ def validate_options(opts):
mobj = range_ != '-' and re.fullmatch(r'([^-]+)?\s*-\s*([^-]+)?', range_)
dur = mobj and (parse_timestamp(mobj.group(1) or '0'), parse_timestamp(mobj.group(2) or 'inf'))
if None in (dur or [None]):
- raise ValueError(f'invalid {name} time range "{regex}". Must be of the form *start-end')
+ raise ValueError(f'invalid {name} time range "{regex}". Must be of the form "*start-end"')
ranges.append(dur)
continue
try:
diff --git a/yt_dlp/extractor/bilibili.py b/yt_dlp/extractor/bilibili.py
index 3274a427d..c12bad881 100644
--- a/yt_dlp/extractor/bilibili.py
+++ b/yt_dlp/extractor/bilibili.py
@@ -1013,7 +1013,7 @@ class BiliIntlIE(BiliIntlBaseIE):
class BiliIntlSeriesIE(BiliIntlBaseIE):
- IE_NAME = 'biliintl:series'
+ IE_NAME = 'biliIntl:series'
_VALID_URL = r'https?://(?:www\.)?bili(?:bili\.tv|intl\.com)/(?:[a-zA-Z]{2}/)?play/(?P<id>\d+)/?(?:[?#]|$)'
_TESTS = [{
'url': 'https://www.bilibili.tv/en/play/34613',
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py
index 21d5c39fd..b18d2e73e 100644
--- a/yt_dlp/extractor/common.py
+++ b/yt_dlp/extractor/common.py
@@ -1262,7 +1262,9 @@ class InfoExtractor:
Like _search_regex, but strips HTML tags and unescapes entities.
"""
res = self._search_regex(pattern, string, name, default, fatal, flags, group)
- if res:
+ if isinstance(res, tuple):
+ return [clean_html(r).strip() for r in res]
+ elif res:
return clean_html(res).strip()
else:
return res
@@ -3512,7 +3514,7 @@ class InfoExtractor:
elif cls.IE_DESC:
desc += f' {cls.IE_DESC}'
if cls.SEARCH_KEY:
- desc += f'; "{cls.SEARCH_KEY}:" prefix'
+ desc += f'{";" if cls.IE_DESC else ""} "{cls.SEARCH_KEY}:" prefix'
if search_examples:
_COUNTS = ('', '5', '10', 'all')
desc += f' (e.g. "{cls.SEARCH_KEY}{random.choice(_COUNTS)}:{random.choice(search_examples)}")'
diff --git a/yt_dlp/extractor/crunchyroll.py b/yt_dlp/extractor/crunchyroll.py
index ee344ce8b..808ce5d3b 100644
--- a/yt_dlp/extractor/crunchyroll.py
+++ b/yt_dlp/extractor/crunchyroll.py
@@ -182,7 +182,7 @@ class CrunchyrollBetaIE(CrunchyrollBaseIE):
self.to_screen(
'To get all formats of a hardsub language, use '
'"--extractor-args crunchyrollbeta:hardsub=<language_code or all>". '
- 'See https://github.com/yt-dlp/yt-dlp#crunchyrollbeta for more info',
+ 'See https://github.com/yt-dlp/yt-dlp#crunchyrollbeta-crunchyroll for more info',
only_once=True)
else:
full_format_langs = set(map(str.lower, available_formats))
diff --git a/yt_dlp/extractor/yandexvideo.py b/yt_dlp/extractor/yandexvideo.py
index 535b61f65..727250ee8 100644
--- a/yt_dlp/extractor/yandexvideo.py
+++ b/yt_dlp/extractor/yandexvideo.py
@@ -270,9 +270,9 @@ class ZenYandexIE(InfoExtractor):
for s_url in stream_urls:
ext = determine_ext(s_url)
if ext == 'mpd':
- formats.extend(self._extract_mpd_formats(s_url, id, mpd_id='dash'))
+ formats.extend(self._extract_mpd_formats(s_url, video_id, mpd_id='dash'))
elif ext == 'm3u8':
- formats.extend(self._extract_m3u8_formats(s_url, id, 'mp4'))
+ formats.extend(self._extract_m3u8_formats(s_url, video_id, 'mp4'))
return {
'id': video_id,
'title': video_json.get('title') or self._og_search_title(webpage),
diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py
index 506bd1e19..2fd61c871 100644
--- a/yt_dlp/extractor/youtube.py
+++ b/yt_dlp/extractor/youtube.py
@@ -292,7 +292,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
"""Provide base functions for Youtube extractors"""
_RESERVED_NAMES = (
- r'channel|c|user|playlist|watch|w|v|embed|e|watch_popup|clip|'
+ r'channel|c|user|playlist|watch|w|v|embed|e|live|watch_popup|clip|'
r'shorts|movies|results|search|shared|hashtag|trending|explore|feed|feeds|'
r'browse|oembed|get_video_info|iframe_api|s/player|source|'
r'storefront|oops|index|account|t/terms|about|upload|signin|logout')
@@ -3683,7 +3683,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'url': fmt_url,
'width': int_or_none(fmt.get('width')),
'language': join_nonempty(audio_track.get('id', '').split('.')[0],
- 'desc' if language_preference < -1 else ''),
+ 'desc' if language_preference < -1 else '') or None,
'language_preference': language_preference,
# Strictly de-prioritize damaged and 3gp formats
'preference': -10 if is_damaged else -2 if itag == '17' else None,
diff --git a/yt_dlp/options.py b/yt_dlp/options.py
index 113a73a70..83e851b19 100644
--- a/yt_dlp/options.py
+++ b/yt_dlp/options.py
@@ -109,7 +109,7 @@ def parseOpts(overrideArguments=None, ignore_config_files='if_override'):
opts = optparse.Values({'verbose': True, 'print_help': False})
try:
try:
- if overrideArguments:
+ if overrideArguments is not None:
root.append_config(overrideArguments, label='Override')
else:
root.append_config(sys.argv[1:], label='Command-line')
@@ -904,11 +904,11 @@ def create_parser():
'This option can be used multiple times to set the sleep for the different retry types, '
'e.g. --retry-sleep linear=1::2 --retry-sleep fragment:exp=1:20'))
downloader.add_option(
- '--skip-unavailable-fragments', '--no-abort-on-unavailable-fragment',
+ '--skip-unavailable-fragments', '--no-abort-on-unavailable-fragments',
action='store_true', dest='skip_unavailable_fragments', default=True,
- help='Skip unavailable fragments for DASH, hlsnative and ISM downloads (default) (Alias: --no-abort-on-unavailable-fragment)')
+ help='Skip unavailable fragments for DASH, hlsnative and ISM downloads (default) (Alias: --no-abort-on-unavailable-fragments)')
downloader.add_option(
- '--abort-on-unavailable-fragment', '--no-skip-unavailable-fragments',
+ '--abort-on-unavailable-fragments', '--no-skip-unavailable-fragments',
action='store_false', dest='skip_unavailable_fragments',
help='Abort download if a fragment is unavailable (Alias: --no-skip-unavailable-fragments)')
downloader.add_option(
diff --git a/yt_dlp/postprocessor/ffmpeg.py b/yt_dlp/postprocessor/ffmpeg.py
index 069066e0c..9b70d749f 100644
--- a/yt_dlp/postprocessor/ffmpeg.py
+++ b/yt_dlp/postprocessor/ffmpeg.py
@@ -407,7 +407,7 @@ class FFmpegPostProcessor(PostProcessor):
"""
concat_file = f'{out_file}.concat'
self.write_debug(f'Writing concat spec to {concat_file}')
- with open(concat_file, 'wt', encoding='utf-8') as f:
+ with open(concat_file, 'w', encoding='utf-8') as f:
f.writelines(self._concat_spec(in_files, concat_opts))
out_flags = list(self.stream_copy_opts(ext=determine_ext(out_file)))
@@ -711,7 +711,7 @@ class FFmpegMetadataPP(FFmpegPostProcessor):
@staticmethod
def _get_chapter_opts(chapters, metadata_filename):
- with open(metadata_filename, 'wt', encoding='utf-8') as f:
+ with open(metadata_filename, 'w', encoding='utf-8') as f:
def ffmpeg_escape(text):
return re.sub(r'([\\=;#\n])', r'\\\1', text)
@@ -981,7 +981,7 @@ class FFmpegSubtitlesConvertorPP(FFmpegPostProcessor):
with open(dfxp_file, 'rb') as f:
srt_data = dfxp2srt(f.read())
- with open(srt_file, 'wt', encoding='utf-8') as f:
+ with open(srt_file, 'w', encoding='utf-8') as f:
f.write(srt_data)
old_file = srt_file
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index eeb984cea..d02b0bac0 100644
--- a/yt_dlp/utils.py
+++ b/yt_dlp/utils.py
@@ -3368,7 +3368,7 @@ def js_to_json(code, vars={}, *, strict=False):
try:
if not strict:
json.loads(vars[v])
- except json.decoder.JSONDecodeError:
+ except json.JSONDecodeError:
return json.dumps(vars[v])
else:
return vars[v]