From ee48b6a88f4b8f076699f539ee4c92389fa37643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Sat, 18 Jul 2015 19:15:20 +0600 Subject: [PATCH] [vk] Capture error message --- youtube_dl/extractor/vk.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/youtube_dl/extractor/vk.py b/youtube_dl/extractor/vk.py index 98bd3a141..9487fc9f5 100644 --- a/youtube_dl/extractor/vk.py +++ b/youtube_dl/extractor/vk.py @@ -205,6 +205,12 @@ def _real_extract(self, url): info_page = self._download_webpage(info_url, video_id) + error_message = self._html_search_regex( + r'(?s)]+class="video_layer_message"[^>]*>(.+?)', + 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.',