aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-05-20 21:55:26 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-05-20 23:13:31 +0530
commitca6d59d2c1a38433708d4a739e812c0bc52655bc (patch)
tree2c43722fb7359c252c933489a103ce9b5b8c30e9
parent1a8cc83735ed748afa78764af1e724afa646d8f9 (diff)
downloadhypervideo-pre-ca6d59d2c1a38433708d4a739e812c0bc52655bc.tar.lz
hypervideo-pre-ca6d59d2c1a38433708d4a739e812c0bc52655bc.tar.xz
hypervideo-pre-ca6d59d2c1a38433708d4a739e812c0bc52655bc.zip
Fix `--simulate --max-downloads`
Bug in c3e6ffba536980e5e1af00e0ecb2275621b4db17 Closes #3815
-rw-r--r--yt_dlp/YoutubeDL.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index 3dc11463c..037b24d00 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -2877,8 +2877,13 @@ class YoutubeDL:
# Forced printings
self.__forced_printings(info_dict, full_filename, incomplete=('format' not in info_dict))
+ def check_max_downloads():
+ if self._num_downloads >= float(self.params.get('max_downloads') or 'inf'):
+ raise MaxDownloadsReached()
+
if self.params.get('simulate'):
info_dict['__write_download_archive'] = self.params.get('force_write_download_archive')
+ check_max_downloads()
return
if full_filename is None:
@@ -3221,10 +3226,7 @@ class YoutubeDL:
# Make sure the info_dict was modified in-place
assert info_dict is original_infodict
-
- max_downloads = self.params.get('max_downloads')
- if max_downloads is not None and self._num_downloads >= int(max_downloads):
- raise MaxDownloadsReached()
+ check_max_downloads()
def __download_wrapper(self, func):
@functools.wraps(func)