A feature-rich command-line audio/video downloader
Fix `--simulate --max-downloads`
pukkandanca6d59d2c1a3
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.pyindex 3dc11463c3..037b24d008 100644--- a/yt_dlp/YoutubeDL.py+++ b/yt_dlp/YoutubeDL.py@@ -2877,8 +2877,13 @@ class YoutubeDL:# Forced printingsself.__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()returnif full_filename is None:@@ -3221,10 +3226,7 @@ class YoutubeDL:# Make sure the info_dict was modified in-placeassert 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)