Explorar o código

[megavideoz] Check non-existing videos

Sergey M․ %!s(int64=10) %!d(string=hai) anos
pai
achega
6e218b3f9a
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      youtube_dl/extractor/megavideoz.py

+ 4 - 0
youtube_dl/extractor/megavideoz.py

@@ -5,6 +5,7 @@ import re
 
 from .common import InfoExtractor
 from ..utils import (
+    ExtractorError,
     float_or_none,
     xpath_text,
 )
@@ -31,6 +32,9 @@ class MegaVideozIE(InfoExtractor):
 
         webpage = self._download_webpage(url, display_id)
 
+        if '>Video Not Found<' in webpage:
+            raise ExtractorError('Video %s does not exist' % video_id, expected=True)
+
         config = self._download_xml(
             self._search_regex(
                 r"var\s+cnf\s*=\s*'([^']+)'", webpage, 'cnf url'),