1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2025-07-11 21:06:19 +00:00

Merge cffb95942ab54474a054fa0c9ecc18131633288e into c5098961b04ce83f4615f2a846c84f803b072639

This commit is contained in:
Deleted user 2024-08-21 22:21:51 -04:00 committed by GitHub
commit 8d102b29b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -472,11 +472,11 @@ class YoutubeDL(object):
register_socks_protocols()
def warn_if_short_id(self, argv):
def warn_if_short_id(self, argv, parser):
# short YouTube ID starting with dash?
idxs = [
i for i, a in enumerate(argv)
if re.match(r'^-[0-9A-Za-z_-]{10}$', a)]
if re.match(r'^-[0-9A-Za-z_-]{10}$', a) and not parser.has_option(a)]
if idxs:
correct_argv = (
['youtube-dl']

View File

@ -12,6 +12,7 @@ import sys
from .options import (
_hide_login_info,
parseOpts,
)
from .compat import (
@ -455,7 +456,7 @@ def _real_main(argv=None):
if opts.update_self or opts.rm_cachedir:
sys.exit()
ydl.warn_if_short_id(sys.argv[1:] if argv is None else argv)
ydl.warn_if_short_id(_hide_login_info(sys.argv[1:] if argv is None else argv), parser)
parser.error(
'You must provide at least one URL.\n'
'Type youtube-dl --help to see a list of all options.')