]> jfr.im git - yt-dlp.git/commitdiff
Stop immediately when reaching '--max-downloads' (https://github.com/ytdl-org/youtube...
authorpukkandan <redacted>
Sat, 9 Jan 2021 12:08:12 +0000 (17:38 +0530)
committerpukkandan <redacted>
Sat, 9 Jan 2021 12:38:06 +0000 (18:08 +0530)
Authored by: glenn-slayden

youtube_dlc/YoutubeDL.py

index 3bae07764af50e3e17a7a09739c32c140d9664a1..2ecb137fc9b6043356f74a0431a348bdd4afc1ba 100644 (file)
@@ -2220,6 +2220,9 @@ def compatible_formats(formats):
 
         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."""