From cac5eedcfc245e6bc23348f64a61b9e618c2f51d Mon Sep 17 00:00:00 2001 From: Paul Storkman Date: Fri, 27 Dec 2024 19:43:00 +0100 Subject: [PATCH] Make sure the retry options are positive or 0. --- yt_dlp/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/yt_dlp/__init__.py b/yt_dlp/__init__.py index 20111175b1..eaf4163d0f 100644 --- a/yt_dlp/__init__.py +++ b/yt_dlp/__init__.py @@ -261,9 +261,11 @@ def validate_options(opts): elif value in ('inf', 'infinite'): return float('inf') try: - return int(value) + ival = int(value) except (TypeError, ValueError): validate(False, f'{name} retry count', value) + validate_positive(f'{name} retry count', ival) + return ival opts.retries = parse_retries('download', opts.retries) opts.fragment_retries = parse_retries('fragment', opts.fragment_retries)