[ok] Capture error message
authorSergey M․ <dstftw@gmail.com>
Thu, 17 Sep 2015 16:59:15 +0000 (22:59 +0600)
committerSergey M․ <dstftw@gmail.com>
Thu, 17 Sep 2015 16:59:15 +0000 (22:59 +0600)
youtube_dl/extractor/odnoklassniki.py

index 66520c2c56f102e53fe84c5e9970558b4714247b..0cd96c10aba1d673bd678b8b2936ab70084def6f 100644 (file)
@@ -4,6 +4,7 @@ from __future__ import unicode_literals
 from .common import InfoExtractor
 from ..compat import compat_urllib_parse_unquote
 from ..utils import (
+    ExtractorError,
     unified_strdate,
     int_or_none,
     qualities,
@@ -72,6 +73,12 @@ class OdnoklassnikiIE(InfoExtractor):
         webpage = self._download_webpage(
             'http://ok.ru/video/%s' % video_id, video_id)
 
+        error = self._search_regex(
+            r'[^>]+class="vp_video_stub_txt"[^>]*>([^<]+)<',
+            webpage, 'error', default=None)
+        if error:
+            raise ExtractorError(error, expected=True)
+
         player = self._parse_json(
             unescapeHTML(self._search_regex(
                 r'data-options=(?P<quote>["\'])(?P<player>{.+?%s.+?})(?P=quote)' % video_id,