[vk] Capture error message
authorSergey M․ <dstftw@gmail.com>
Sat, 18 Jul 2015 13:15:20 +0000 (19:15 +0600)
committerSergey M․ <dstftw@gmail.com>
Sat, 18 Jul 2015 13:15:20 +0000 (19:15 +0600)
youtube_dl/extractor/vk.py

index 98bd3a14145cced545bbe1a7f9051baa1ef8d6ff..9487fc9f56be4e60aead198c3f34e7e7694ca198 100644 (file)
@@ -205,6 +205,12 @@ class VKIE(InfoExtractor):
 
         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):
             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.',