mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-02 17:22:31 +01:00
adds thumbnail support for ZDF Mediathek extractor
This commit is contained in:
parent
a6e0afa2bb
commit
264b23e1a4
@ -70,6 +70,23 @@ def xml_to_format(fnode):
|
|||||||
'_available': is_available,
|
'_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')
|
format_nodes = doc.findall('.//formitaeten/formitaet')
|
||||||
formats = list(filter(
|
formats = list(filter(
|
||||||
lambda f: f['_available'],
|
lambda f: f['_available'],
|
||||||
@ -81,6 +98,8 @@ def xml_to_format(fnode):
|
|||||||
'title': title,
|
'title': title,
|
||||||
'description': description,
|
'description': description,
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'thumbnails': thumbnails,
|
||||||
'uploader': uploader,
|
'uploader': uploader,
|
||||||
'uploader_id': uploader_id,
|
'uploader_id': uploader_id,
|
||||||
'upload_date': upload_date,
|
'upload_date': upload_date,
|
||||||
|
Loading…
Reference in New Issue
Block a user