1
0
Fork 0
mirror of https://gitlab.com/dstftw/youtube-dl.git synced 2020-11-16 09:42:26 +00:00

check if key attrib matches resolution pattern

This commit is contained in:
kennell 2015-10-18 21:07:52 +02:00
parent 8cc83d301d
commit b243340f0c

View file

@ -75,9 +75,9 @@ def extract_from_xml_url(ie, video_id, xml_url):
for node in fnode: for node in fnode:
thumbnail = {'url': node.text} thumbnail = {'url': node.text}
if 'key' in node.attrib: if 'key' in node.attrib:
width_x_height = node.attrib['key'] if re.match("^[0-9]+x[0-9]+$", node.attrib['key']):
thumbnail['width'] = int_or_none(width_x_height.split('x')[0]) thumbnail['width'] = int_or_none(node.attrib['key'].split('x')[0])
thumbnail['height'] = int_or_none(width_x_height.split('x')[1]) thumbnail['height'] = int_or_none(node.attrib['key'].split('x')[1])
thumbnails.append(thumbnail) thumbnails.append(thumbnail)
return thumbnails return thumbnails