Browse Source

[vk] Capture error message

Sergey M․ 10 years ago
parent
commit
ee48b6a88f
1 changed files with 6 additions and 0 deletions
  1. 6 0
      youtube_dl/extractor/vk.py

+ 6 - 0
youtube_dl/extractor/vk.py

@@ -205,6 +205,12 @@ class VKIE(InfoExtractor):
 
 
         info_page = self._download_webpage(info_url, video_id)
         info_page = self._download_webpage(info_url, video_id)
 
 
+        error_message = self._html_search_regex(
+            r'(?s)<!><div[^>]+class="video_layer_message"[^>]*>(.+?)</div>',
+            info_page, 'error message', default=None)
+        if error_message:
+            raise ExtractorError(error_message, expected=True)
+
         if re.search(r'<!>/login\.php\?.*\bact=security_check', info_page):
         if re.search(r'<!>/login\.php\?.*\bact=security_check', info_page):
             raise ExtractorError(
             raise ExtractorError(
                 'You are trying to log in from an unusual location. You should confirm ownership at vk.com to log in with this IP.',
                 'You are trying to log in from an unusual location. You should confirm ownership at vk.com to log in with this IP.',