[xvideos] Capture and output inline error if any
authorSergey M․ <dstftw@gmail.com>
Fri, 6 Jun 2014 14:15:06 +0000 (21:15 +0700)
committerSergey M․ <dstftw@gmail.com>
Fri, 6 Jun 2014 14:15:06 +0000 (21:15 +0700)
youtube_dl/extractor/xvideos.py

index 85e99e1b02b8ab7e7647d6c91dbad08f4827d5f3..f21e0671f45f6ca4f71c6f5471a128a44055379c 100644 (file)
@@ -5,6 +5,8 @@ import re
 from .common import InfoExtractor
 from ..utils import (
     compat_urllib_parse,
+    ExtractorError,
+    clean_html,
 )
 
 
@@ -28,6 +30,10 @@ class XVideosIE(InfoExtractor):
 
         self.report_extraction(video_id)
 
+        mobj = re.search(r'<h1 class="inlineError">(.+?)</h1>', webpage)
+        if mobj:
+            raise ExtractorError('%s said: %s' % (self.IE_NAME, clean_html(mobj.group(1))), expected=True)
+
         # Extract video URL
         video_url = compat_urllib_parse.unquote(
             self._search_regex(r'flv_url=(.+?)&', webpage, 'video URL'))