mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 12:01:28 +00:00
check if key attrib matches resolution pattern
This commit is contained in:
parent
8cc83d301d
commit
b243340f0c
|
@ -75,9 +75,9 @@ def xml_to_thumbnails(fnode):
|
|||
for node in fnode:
|
||||
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])
|
||||
if re.match("^[0-9]+x[0-9]+$", node.attrib['key']):
|
||||
thumbnail['width'] = int_or_none(node.attrib['key'].split('x')[0])
|
||||
thumbnail['height'] = int_or_none(node.attrib['key'].split('x')[1])
|
||||
thumbnails.append(thumbnail)
|
||||
return thumbnails
|
||||
|
||||
|
|
Loading…
Reference in a new issue