浏览代码

Throw an error if no video formats are found

Philipp Hagemeister 11 年之前
父节点
当前提交
7e8caf30c0
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      youtube_dl/extractor/common.py

+ 3 - 0
youtube_dl/extractor/common.py

@@ -466,6 +466,9 @@ class InfoExtractor(object):
         return RATING_TABLE.get(rating.lower(), None)
         return RATING_TABLE.get(rating.lower(), None)
 
 
     def _sort_formats(self, formats):
     def _sort_formats(self, formats):
+        if not formats:
+            raise ExtractorError(u'No video formats found')
+
         def _formats_key(f):
         def _formats_key(f):
             # TODO remove the following workaround
             # TODO remove the following workaround
             from ..utils import determine_ext
             from ..utils import determine_ext