]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[mtv] Capture and output error message (#5420)
authorSergey M․ <dstftw@gmail.com>
Wed, 15 Apr 2015 15:02:34 +0000 (21:02 +0600)
committerSergey M․ <dstftw@gmail.com>
Wed, 15 Apr 2015 15:02:34 +0000 (21:02 +0600)
youtube_dl/extractor/mtv.py

index c11de1cb61b28d03ab2430ff1db3a82d317dc718..4430b3416afc8af1fab70e47fb597710d6c5a75b 100644 (file)
@@ -118,6 +118,14 @@ class MTVServicesInfoExtractor(InfoExtractor):
         mediagen_doc = self._download_xml(mediagen_url, video_id,
                                           'Downloading video urls')
 
+        item = mediagen_doc.find('./video/item')
+        if item is not None and item.get('type') == 'text':
+            message = '%s returned error: ' % self.IE_NAME
+            if item.get('code') is not None:
+                message += '%s - ' % item.get('code')
+            message += item.text
+            raise ExtractorError(message, expected=True)
+
         description_node = itemdoc.find('description')
         if description_node is not None:
             description = description_node.text.strip()