[newstube] Capture error message
authorSergey M․ <dstftw@gmail.com>
Sun, 6 Jul 2014 11:53:31 +0000 (18:53 +0700)
committerSergey M․ <dstftw@gmail.com>
Sun, 6 Jul 2014 11:53:31 +0000 (18:53 +0700)
youtube_dl/extractor/newstube.py

index 2fd5b8f0430351cd7eadf8b5acef3cf5786d27ab..a860350af1f0452ff4406f7ae156934d671e42ce 100644 (file)
@@ -4,6 +4,7 @@ from __future__ import unicode_literals
 import re
 
 from .common import InfoExtractor
+from ..utils import ExtractorError
 
 
 class NewstubeIE(InfoExtractor):
@@ -40,6 +41,10 @@ class NewstubeIE(InfoExtractor):
         def ns(s):
             return s.replace('/', '/%(ns)s') % {'ns': '{http://app1.newstube.ru/N2SiteWS/player.asmx}'}
 
+        error_message = player.find(ns('./ErrorMessage'))
+        if error_message is not None:
+            raise ExtractorError('%s returned error: %s' % (self.IE_NAME, error_message.text), expected=True)
+
         session_id = player.find(ns('./SessionId')).text
         media_info = player.find(ns('./Medias/MediaInfo'))
         title = media_info.find(ns('./Name')).text