about summary refs log tree commit diff
path: root/youtube_dl/extractor/dreisat.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-04-04 23:28:47 +0600
committerSergey M․ <dstftw@gmail.com>2015-04-04 23:28:47 +0600
commit218d6bcc05bd84d8f69a7b764702dc24acb2f761 (patch)
tree30f2e8908b97c39a0b6779a14c127dd46ec4cec3 /youtube_dl/extractor/dreisat.py
parent7d2546397209deab14a0ebad6c933ed97e73fe41 (diff)
downloadyoutube-dl-218d6bcc05bd84d8f69a7b764702dc24acb2f761.tar.gz
youtube-dl-218d6bcc05bd84d8f69a7b764702dc24acb2f761.tar.xz
youtube-dl-218d6bcc05bd84d8f69a7b764702dc24acb2f761.zip
[dreisat] Capture status errors
Diffstat (limited to 'youtube_dl/extractor/dreisat.py')
-rw-r--r--youtube_dl/extractor/dreisat.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/youtube_dl/extractor/dreisat.py b/youtube_dl/extractor/dreisat.py
index 69ca75423..b88460a23 100644
--- a/youtube_dl/extractor/dreisat.py
+++ b/youtube_dl/extractor/dreisat.py
@@ -3,7 +3,10 @@ from __future__ import unicode_literals
 import re
 
 from .common import InfoExtractor
-from ..utils import unified_strdate
+from ..utils import (
+    ExtractorError,
+    unified_strdate,
+)
 
 
 class DreiSatIE(InfoExtractor):
@@ -28,6 +31,15 @@ class DreiSatIE(InfoExtractor):
         details_url = 'http://www.3sat.de/mediathek/xmlservice/web/beitragsDetails?ak=web&id=%s' % video_id
         details_doc = self._download_xml(details_url, video_id, 'Downloading video details')
 
+        status_code = details_doc.find('./status/statuscode')
+        if status_code is not None and status_code.text != 'ok':
+            code = status_code.text
+            if code == 'notVisibleAnymore':
+                message = 'Video %s is not available' % video_id
+            else:
+                message = '%s returned error: %s' % (self.IE_NAME, code)
+            raise ExtractorError(message, expected=True)
+
         thumbnail_els = details_doc.findall('.//teaserimage')
         thumbnails = [{
             'width': int(te.attrib['key'].partition('x')[0]),