From 7977b329ed97b216e37bd402f4935f28c00eac9e Mon Sep 17 00:00:00 2001 From: bashonly <88596187+bashonly@users.noreply.github.com> Date: Thu, 22 May 2025 04:33:11 -0500 Subject: [PATCH] [cleanup] Misc (#13166) Authored by: bashonly --- README.md | 1 + yt_dlp/extractor/playsuisse.py | 3 +-- yt_dlp/extractor/soundcloud.py | 2 +- yt_dlp/extractor/twitter.py | 2 +- yt_dlp/options.py | 11 +++++++---- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index aaa3beb716..518c63eefc 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ yt-dlp is a feature-rich command-line audio/video downloader with support for [t * [Post-processing Options](#post-processing-options) * [SponsorBlock Options](#sponsorblock-options) * [Extractor Options](#extractor-options) + * [Preset Aliases](#preset-aliases) * [CONFIGURATION](#configuration) * [Configuration file encoding](#configuration-file-encoding) * [Authentication with netrc](#authentication-with-netrc) diff --git a/yt_dlp/extractor/playsuisse.py b/yt_dlp/extractor/playsuisse.py index 9bf5765fa7..46e3a5b8ff 100644 --- a/yt_dlp/extractor/playsuisse.py +++ b/yt_dlp/extractor/playsuisse.py @@ -9,11 +9,10 @@ from ..utils import ( int_or_none, join_nonempty, parse_qs, - traverse_obj, update_url_query, urlencode_postdata, ) -from ..utils.traversal import unpack +from ..utils.traversal import traverse_obj, unpack class PlaySuisseIE(InfoExtractor): diff --git a/yt_dlp/extractor/soundcloud.py b/yt_dlp/extractor/soundcloud.py index c70940a606..3496a08ef6 100644 --- a/yt_dlp/extractor/soundcloud.py +++ b/yt_dlp/extractor/soundcloud.py @@ -697,7 +697,7 @@ class SoundcloudIE(SoundcloudBaseIE): try: return self._extract_info_dict(info, full_title, token) except ExtractorError as e: - if not isinstance(e.cause, HTTPError) or not e.cause.status == 429: + if not isinstance(e.cause, HTTPError) or e.cause.status != 429: raise self.report_warning( 'You have reached the API rate limit, which is ~600 requests per ' diff --git a/yt_dlp/extractor/twitter.py b/yt_dlp/extractor/twitter.py index 5eee3e7263..ad3e745884 100644 --- a/yt_dlp/extractor/twitter.py +++ b/yt_dlp/extractor/twitter.py @@ -1342,7 +1342,7 @@ class TwitterIE(TwitterBaseIE): 'tweet_mode': 'extended', }) except ExtractorError as e: - if not isinstance(e.cause, HTTPError) or not e.cause.status == 429: + if not isinstance(e.cause, HTTPError) or e.cause.status != 429: raise self.report_warning('Rate-limit exceeded; falling back to syndication endpoint') status = self._call_syndication_api(twid) diff --git a/yt_dlp/options.py b/yt_dlp/options.py index 19f16e7251..b4d3d4d668 100644 --- a/yt_dlp/options.py +++ b/yt_dlp/options.py @@ -230,6 +230,9 @@ class _YoutubeDLOptionParser(optparse.OptionParser): formatter.indent() heading = formatter.format_heading('Preset Aliases') formatter.indent() + description = formatter.format_description( + 'Predefined aliases for convenience and ease of use. Note that future versions of yt-dlp ' + 'may add or adjust presets, but the existing preset names will not be changed or removed') result = [] for name, args in _PRESET_ALIASES.items(): option = optparse.Option('-t', help=shlex.join(args)) @@ -238,7 +241,7 @@ class _YoutubeDLOptionParser(optparse.OptionParser): formatter.dedent() formatter.dedent() help_lines = '\n'.join(result) - return f'{formatted_help}\n{heading}{help_lines}' + return f'{formatted_help}\n{heading}{description}\n{help_lines}' def create_parser(): @@ -470,7 +473,7 @@ def create_parser(): general.add_option( '--live-from-start', action='store_true', dest='live_from_start', - help='Download livestreams from the start. Currently only supported for YouTube (experimental) and Twitch') + help='Download livestreams from the start. Currently experimental and only supported for YouTube and Twitch') general.add_option( '--no-live-from-start', action='store_false', dest='live_from_start', @@ -545,9 +548,9 @@ def create_parser(): help=( 'Create aliases for an option string. Unless an alias starts with a dash "-", it is prefixed with "--". ' 'Arguments are parsed according to the Python string formatting mini-language. ' - 'E.g. --alias get-audio,-X "-S=aext:{0},abr -x --audio-format {0}" creates options ' + 'E.g. --alias get-audio,-X "-S aext:{0},abr -x --audio-format {0}" creates options ' '"--get-audio" and "-X" that takes an argument (ARG0) and expands to ' - '"-S=aext:ARG0,abr -x --audio-format ARG0". All defined aliases are listed in the --help output. ' + '"-S aext:ARG0,abr -x --audio-format ARG0". All defined aliases are listed in the --help output. ' 'Alias options can trigger more aliases; so be careful to avoid defining recursive options. ' f'As a safety measure, each alias may be triggered a maximum of {_YoutubeDLOptionParser.ALIAS_TRIGGER_LIMIT} times. ' 'This option can be used multiple times'))