浏览代码

Implement the max quality option in YoutubeDL

Jaime Marquínez Ferrándiz 12 年之前
父节点
当前提交
99e206d508
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      youtube_dl/YoutubeDL.py

+ 4 - 0
youtube_dl/YoutubeDL.py

@@ -469,6 +469,10 @@ class YoutubeDL(object):
             self.list_formats(info_dict)
             return
 
+        format_limit = self.params.get('format_limit', None)
+        if format_limit:
+            formats = [f for f in formats if f['format_id'] <= format_limit]
+
         req_format = self.params.get('format', 'best')
         formats_to_download = []
         if req_format == 'best' or req_format is None: