فهرست منبع

check if key attrib matches resolution pattern

kennell 10 سال پیش
والد
کامیت
b243340f0c
1فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 3 3
      youtube_dl/extractor/zdf.py

+ 3 - 3
youtube_dl/extractor/zdf.py

@@ -75,9 +75,9 @@ def extract_from_xml_url(ie, video_id, xml_url):
         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