mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 03:03:01 +00:00
simplify thumbnail dict building
This commit is contained in:
parent
b243340f0c
commit
b7cedb1604
1 changed files with 4 additions and 3 deletions
|
@ -75,9 +75,10 @@ def xml_to_thumbnails(fnode):
|
|||
for node in fnode:
|
||||
thumbnail = {'url': node.text}
|
||||
if 'key' in node.attrib:
|
||||
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])
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue