diff options
author | Sergey M. <dstftw@gmail.com> | 2015-10-19 01:30:14 +0600 |
---|---|---|
committer | Sergey M. <dstftw@gmail.com> | 2015-10-19 01:30:14 +0600 |
commit | 334b5c3b720feb1a88bd071f16c84d1644057655 (patch) | |
tree | ae18a44844482ee6608f8da3d42f32c6b90a4a10 /youtube_dl/extractor | |
parent | 2038ad6ee71c842420b83cb6c5ce3c6898e8e380 (diff) | |
parent | b7cedb16043c60d4032b206a83539acbd39f994f (diff) |
Merge pull request #7225 from kennell/master
[zdf] Extract thumbnails
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r-- | youtube_dl/extractor/zdf.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/youtube_dl/extractor/zdf.py b/youtube_dl/extractor/zdf.py index 98f15177b..c2b196504 100644 --- a/youtube_dl/extractor/zdf.py +++ b/youtube_dl/extractor/zdf.py @@ -70,6 +70,22 @@ def extract_from_xml_url(ie, video_id, xml_url): '_available': is_available, } + def xml_to_thumbnails(fnode): + thumbnails = list() + for node in fnode: + thumbnail = {'url': node.text} + if 'key' in node.attrib: + m = re.match('^([0-9]+)x([0-9]+)$', node.attrib['key']) + if m: + thumbnail['width'] = int(m.group(1)) + thumbnail['height'] = int(m.group(2)) + thumbnails.append(thumbnail) + return thumbnails + + + thumbnail_nodes = doc.findall('.//teaserimages/teaserimage') + thumbnails = xml_to_thumbnails(thumbnail_nodes) + format_nodes = doc.findall('.//formitaeten/formitaet') formats = list(filter( lambda f: f['_available'], @@ -81,6 +97,7 @@ def extract_from_xml_url(ie, video_id, xml_url): 'title': title, 'description': description, 'duration': duration, + 'thumbnails': thumbnails, 'uploader': uploader, 'uploader_id': uploader_id, 'upload_date': upload_date, |