aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorkennell <kevin@fileperms.org>2015-10-18 20:47:42 +0200
committerkennell <kevin@fileperms.org>2015-10-18 20:47:42 +0200
commit8cc83d301dd0e8029aff804e362860d36e3d7e7a (patch)
tree440fdff9c4ccda2efea2e5e7649dcb9e24cea61d /youtube_dl
parent264b23e1a42378d52f8774a07c1d906cd1cff96c (diff)
use int_or_none, check if attrib exists, remove thumbnail
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/zdf.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/youtube_dl/extractor/zdf.py b/youtube_dl/extractor/zdf.py
index f376025e1..d41c4e712 100644
--- a/youtube_dl/extractor/zdf.py
+++ b/youtube_dl/extractor/zdf.py
@@ -73,19 +73,17 @@ def extract_from_xml_url(ie, video_id, xml_url):
def xml_to_thumbnails(fnode):
thumbnails = list()
for node in fnode:
- width_x_height = node.attrib['key']
- thumbnail = {
- 'url': node.text,
- 'width': int(width_x_height.split('x')[0]),
- 'height': int(width_x_height.split('x')[1])
- }
+ thumbnail = {'url': node.text}
+ if 'key' in node.attrib:
+ width_x_height = node.attrib['key']
+ thumbnail['width'] = int_or_none(width_x_height.split('x')[0])
+ thumbnail['height'] = int_or_none(width_x_height.split('x')[1])
thumbnails.append(thumbnail)
return thumbnails
thumbnail_nodes = doc.findall('.//teaserimages/teaserimage')
thumbnails = xml_to_thumbnails(thumbnail_nodes)
- thumbnail = thumbnails[-1]['url']
format_nodes = doc.findall('.//formitaeten/formitaet')
formats = list(filter(
@@ -98,7 +96,6 @@ def extract_from_xml_url(ie, video_id, xml_url):
'title': title,
'description': description,
'duration': duration,
- 'thumbnail': thumbnail,
'thumbnails': thumbnails,
'uploader': uploader,
'uploader_id': uploader_id,