diff options
author | pukkandan <pukkandan@gmail.com> | 2021-01-09 17:38:12 +0530 |
---|---|---|
committer | pukkandan <pukkandan@gmail.com> | 2021-01-09 18:08:06 +0530 |
commit | c3e6ffba536980e5e1af00e0ecb2275621b4db17 (patch) | |
tree | 6a76330cc0c9afaa36e38bfd6bb07cf19a87157e | |
parent | 8c04f0be96399cf23d092b286574f48d768783da (diff) | |
download | hypervideo-pre-c3e6ffba536980e5e1af00e0ecb2275621b4db17.tar.lz hypervideo-pre-c3e6ffba536980e5e1af00e0ecb2275621b4db17.tar.xz hypervideo-pre-c3e6ffba536980e5e1af00e0ecb2275621b4db17.zip |
Stop immediately when reaching '--max-downloads' (https://github.com/ytdl-org/youtube-dl/pull/26638)
Authored by: glenn-slayden
-rw-r--r-- | youtube_dlc/YoutubeDL.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/youtube_dlc/YoutubeDL.py b/youtube_dlc/YoutubeDL.py index 3bae07764..2ecb137fc 100644 --- a/youtube_dlc/YoutubeDL.py +++ b/youtube_dlc/YoutubeDL.py @@ -2220,6 +2220,9 @@ class YoutubeDL(object): if must_record_download_archive or self.params.get('force_write_download_archive', False): self.record_download_archive(info_dict) + max_downloads = self.params.get('max_downloads') + if max_downloads is not None and self._num_downloads >= int(max_downloads): + raise MaxDownloadsReached() def download(self, url_list): """Download a given list of URLs.""" |