소스 검색

[mtv] Capture and output error message (#5420)

Sergey M․ 10 년 전
부모
커밋
0dfe9bc9d2
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 8 0
      youtube_dl/extractor/mtv.py

+ 8 - 0
youtube_dl/extractor/mtv.py

@@ -118,6 +118,14 @@ class MTVServicesInfoExtractor(InfoExtractor):
         mediagen_doc = self._download_xml(mediagen_url, video_id,
         mediagen_doc = self._download_xml(mediagen_url, video_id,
                                           'Downloading video urls')
                                           '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')
         description_node = itemdoc.find('description')
         if description_node is not None:
         if description_node is not None:
             description = description_node.text.strip()
             description = description_node.text.strip()