1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-12-23 08:26:50 +00:00

[dreisat] Capture status errors

This commit is contained in:
Sergey M․ 2015-04-04 23:28:47 +06:00
parent 7d25463972
commit 218d6bcc05

View File

@ -3,7 +3,10 @@ from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import unified_strdate from ..utils import (
ExtractorError,
unified_strdate,
)
class DreiSatIE(InfoExtractor): 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_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') 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') thumbnail_els = details_doc.findall('.//teaserimage')
thumbnails = [{ thumbnails = [{
'width': int(te.attrib['key'].partition('x')[0]), 'width': int(te.attrib['key'].partition('x')[0]),