mirror of
https://github.com/blackjack4494/yt-dlc.git
synced 2024-12-25 17:27:36 +00:00
use int_or_none, check if attrib exists, remove thumbnail
This commit is contained in:
parent
264b23e1a4
commit
8cc83d301d
1 changed files with 5 additions and 8 deletions
|
@ -73,19 +73,17 @@ def extract_from_xml_url(ie, video_id, xml_url):
|
||||||
def xml_to_thumbnails(fnode):
|
def xml_to_thumbnails(fnode):
|
||||||
thumbnails = list()
|
thumbnails = list()
|
||||||
for node in fnode:
|
for node in fnode:
|
||||||
width_x_height = node.attrib['key']
|
thumbnail = {'url': node.text}
|
||||||
thumbnail = {
|
if 'key' in node.attrib:
|
||||||
'url': node.text,
|
width_x_height = node.attrib['key']
|
||||||
'width': int(width_x_height.split('x')[0]),
|
thumbnail['width'] = int_or_none(width_x_height.split('x')[0])
|
||||||
'height': int(width_x_height.split('x')[1])
|
thumbnail['height'] = int_or_none(width_x_height.split('x')[1])
|
||||||
}
|
|
||||||
thumbnails.append(thumbnail)
|
thumbnails.append(thumbnail)
|
||||||
return thumbnails
|
return thumbnails
|
||||||
|
|
||||||
|
|
||||||
thumbnail_nodes = doc.findall('.//teaserimages/teaserimage')
|
thumbnail_nodes = doc.findall('.//teaserimages/teaserimage')
|
||||||
thumbnails = xml_to_thumbnails(thumbnail_nodes)
|
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(
|
||||||
|
@ -98,7 +96,6 @@ def extract_from_xml_url(ie, video_id, xml_url):
|
||||||
'title': title,
|
'title': title,
|
||||||
'description': description,
|
'description': description,
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
'thumbnail': thumbnail,
|
|
||||||
'thumbnails': thumbnails,
|
'thumbnails': thumbnails,
|
||||||
'uploader': uploader,
|
'uploader': uploader,
|
||||||
'uploader_id': uploader_id,
|
'uploader_id': uploader_id,
|
||||||
|
|
Loading…
Reference in a new issue