summary refs log tree commit diff
diff options
context:
space:
mode:
authorkennell <kevin@fileperms.org>2015-10-18 21:25:26 +0200
committerkennell <kevin@fileperms.org>2015-10-18 21:25:26 +0200
commitb7cedb16043c60d4032b206a83539acbd39f994f (patch)
tree5e9904be8562aa50f8ddc84dfc2154f5ec6b544b
parentb243340f0ce311443a15a2dfd4356a9504e18c04 (diff)
downloadyoutube-dl-b7cedb16043c60d4032b206a83539acbd39f994f.tar.gz
youtube-dl-b7cedb16043c60d4032b206a83539acbd39f994f.tar.xz
youtube-dl-b7cedb16043c60d4032b206a83539acbd39f994f.zip
simplify thumbnail dict building
-rw-r--r--youtube_dl/extractor/zdf.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/youtube_dl/extractor/zdf.py b/youtube_dl/extractor/zdf.py
index ed385450c..c2b196504 100644
--- a/youtube_dl/extractor/zdf.py
+++ b/youtube_dl/extractor/zdf.py
@@ -75,9 +75,10 @@ def extract_from_xml_url(ie, video_id, xml_url):
         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