A feature-rich command-line audio/video downloader
[cleanup] Misc
pukkandan08e29b9f1f0b
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.mdindex 5abc6ce41e..7c271565ff 100644--- a/.github/PULL_REQUEST_TEMPLATE.md+++ b/.github/PULL_REQUEST_TEMPLATE.md@@ -2,8 +2,6 @@### Description of your *pull request* and other information-</details>-<!--Explanation of your *pull request* in arbitrary form goes here. Please **make sure the description explains the purpose and effect** of your *pull request* and is worded well enough to be understood. Provide as much **context and examples** as possible@@ -41,3 +39,5 @@ Fixes #- [ ] New extractor ([Piracy websites will not be accepted](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#is-the-website-primarily-used-for-piracy))- [ ] Core bug fix/improvement- [ ] New feature (It is strongly [recommended to open an issue first](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#adding-new-feature-or-making-overarching-changes))++</details>diff --git a/.gitignore b/.gitignoreindex ef4d116167..507ba8c7f1 100644--- a/.gitignore+++ b/.gitignore@@ -30,6 +30,7 @@ cookies*.f4v*.flac*.flv+*.gif*.jpeg*.jpg*.m4a@@ -120,5 +121,5 @@ yt-dlp.zip*/extractor/lazy_extractors.py# Plugins-ytdlp_plugins/*-yt-dlp-plugins/*+ytdlp_plugins/+yt-dlp-pluginsdiff --git a/Collaborators.md b/Collaborators.mdindex 3f24d5c476..da42af917e 100644--- a/Collaborators.md+++ b/Collaborators.md@@ -42,7 +42,7 @@ You can also find lists of all [contributors of yt-dlp](CONTRIBUTORS) and [autho* Improved/fixed support for HiDive, HotStar, Hungama, LBRY, LinkedInLearning, Mxplayer, SonyLiv, TV2, Vimeo, VLive etc-## [Lesmiscore](https://github.com/Lesmiscore) (nao20010128nao)+## [Lesmiscore](https://github.com/Lesmiscore) <sup><sub>(nao20010128nao)</sup></sub>**Bitcoin**: bc1qfd02r007cutfdjwjmyy9w23rjvtls6ncve7r3s**Monacoin**: mona1q3tf7dzvshrhfe3md379xtvt2n22duhglv5dskrdiff --git a/Makefile b/Makefileindex 8f335927d0..ca7d641ab8 100644--- a/Makefile+++ b/Makefile@@ -17,8 +17,8 @@ pypi-files: AUTHORS Changelog.md LICENSE README.md README.txt supportedsites \clean-test:rm -rf test/testdata/sigs/player-*.js tmp/ *.annotations.xml *.aria2 *.description *.dump *.frag \*.frag.aria2 *.frag.urls *.info.json *.live_chat.json *.meta *.part* *.tmp *.temp *.unknown_video *.ytdl \- *.3gp *.ape *.ass *.avi *.desktop *.f4v *.flac *.flv *.jpeg *.jpg *.m4a *.m4v *.mhtml *.mkv *.mov *.mp3 *.mp4 \- *.mpga *.oga *.ogg *.opus *.png *.sbv *.srt *.swf *.swp *.tt *.ttml *.url *.vtt *.wav *.webloc *.webm *.webp+ *.3gp *.ape *.ass *.avi *.desktop *.f4v *.flac *.flv *.gif *.jpeg *.jpg *.m4a *.m4v *.mhtml *.mkv *.mov *.mp3 \+ *.mp4 *.mpga *.oga *.ogg *.opus *.png *.sbv *.srt *.swf *.swp *.tt *.ttml *.url *.vtt *.wav *.webloc *.webm *.webpclean-dist:rm -rf yt-dlp.1.temp.md yt-dlp.1 README.txt MANIFEST build/ dist/ .coverage cover/ yt-dlp.tar.gz completions/ \yt_dlp/extractor/lazy_extractors.py *.spec CONTRIBUTING.md.tmp yt-dlp yt-dlp.exe yt_dlp.egg-info/ AUTHORS .mailmapdiff --git a/README.md b/README.mdindex 1c04564c11..88d15adcc0 100644--- a/README.md+++ b/README.md@@ -10,7 +10,7 @@[](https://discord.gg/H5MNcFW63r "Discord")[](supportedsites.md "Supported Sites")[](LICENSE "License")-[](https://github.com/yt-dlp/yt-dlp/actions "CI Status")+[](https://github.com/yt-dlp/yt-dlp/actions "CI Status")[](https://github.com/yt-dlp/yt-dlp/commits "Commit History")[](https://github.com/yt-dlp/yt-dlp/commits "Commit History")diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.pyindex 7dc88e8a65..37964169f2 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: Falsediff --git a/yt_dlp/__init__.py b/yt_dlp/__init__.pyindex 2e35db1bac..df1a54138d 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)continuetry:diff --git a/yt_dlp/extractor/bilibili.py b/yt_dlp/extractor/bilibili.pyindex 3274a427da..c12bad881b 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.pyindex 21d5c39fdb..b18d2e73eb 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.pyindex ee344ce8be..808ce5d3b8 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.pyindex 535b61f658..727250ee87 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.pyindex 506bd1e19a..2fd61c8715 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.pyindex 113a73a706..83e851b199 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.pyindex 069066e0c6..9b70d749f3 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):@staticmethoddef _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_filediff --git a/yt_dlp/utils.py b/yt_dlp/utils.pyindex eeb984ceaa..d02b0bac04 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]