浏览代码

[googledrive] raise ExtractorError instead of warning

remitamine 10 年之前
父节点
当前提交
8e92d21ebf
共有 1 个文件被更改,包括 6 次插入3 次删除
  1. 6 3
      youtube_dl/extractor/googledrive.py

+ 6 - 3
youtube_dl/extractor/googledrive.py

@@ -1,7 +1,10 @@
 import re
 import re
 
 
 from .common import InfoExtractor
 from .common import InfoExtractor
-from ..utils import RegexNotFoundError
+from ..utils import (
+    RegexNotFoundError,
+    ExtractorError,
+)
 
 
 class GoogleDriveEmbedIE(InfoExtractor):
 class GoogleDriveEmbedIE(InfoExtractor):
     _VALID_URL = r'https?://(?:video\.google\.com/get_player\?.*?docid=|(?:docs|drive)\.google\.com/file/d/)(?P<id>[a-zA-Z0-9_-]{28})'
     _VALID_URL = r'https?://(?:video\.google\.com/get_player\?.*?docid=|(?:docs|drive)\.google\.com/file/d/)(?P<id>[a-zA-Z0-9_-]{28})'
@@ -97,10 +100,10 @@ class GoogleDriveIE(InfoExtractor):
                     webpage,
                     webpage,
                     'reason'
                     'reason'
                 )
                 )
-                self.report_warning(reason)
+                raise ExtractorError(reason)
                 return
                 return
             except RegexNotFoundError:
             except RegexNotFoundError:
-                self.report_warning('not a video')
+                raise ExtractorError('not a video')
                 return
                 return
 
 
         fmt_stream_map = fmt_stream_map.split(',')
         fmt_stream_map = fmt_stream_map.split(',')