]> jfr.im git - yt-dlp.git/blobdiff - youtube_dl/YoutubeDL.py
Extend #980 with --max-quality support
[yt-dlp.git] / youtube_dl / YoutubeDL.py
index f22a8bd0e044b9c10ecad56187a15a310a4c1d7d..fd98321f17b814557c0a77ecdc79fc1dd12f495e 100644 (file)
@@ -488,7 +488,9 @@ def process_video_result(self, info_dict, download=True):
 
         format_limit = self.params.get('format_limit', None)
         if format_limit:
-            formats = [f for f in formats if f['format_id'] <= format_limit]
+            formats = list(takewhile_inclusive(
+                lambda f: f['format_id'] != format_limit, formats
+            ))
         if self.params.get('prefer_free_formats'):
             def _free_formats_key(f):
                 try: