diff options
author | kennell <kevin@fileperms.org> | 2015-10-18 19:56:22 +0200 |
---|---|---|
committer | kennell <kevin@fileperms.org> | 2015-10-18 19:56:22 +0200 |
commit | 264b23e1a42378d52f8774a07c1d906cd1cff96c (patch) | |
tree | 46dc19c5c9efb82dc1cb9068771a5c872a905421 /youtube_dl | |
parent | a6e0afa2bbc93d145b31911b8ce40c502994e2a1 (diff) |
adds thumbnail support for ZDF Mediathek extractor
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/zdf.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/youtube_dl/extractor/zdf.py b/youtube_dl/extractor/zdf.py index 98f15177b..f376025e1 100644 --- a/youtube_dl/extractor/zdf.py +++ b/youtube_dl/extractor/zdf.py @@ -70,6 +70,23 @@ def extract_from_xml_url(ie, video_id, xml_url): '_available': is_available, } + 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]) + } + 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( lambda f: f['_available'], @@ -81,6 +98,8 @@ 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, 'upload_date': upload_date, |