[zdf] Make width extraction more robust
authorPhilipp Hagemeister <phihag@phihag.de>
Wed, 25 Dec 2013 14:33:09 +0000 (15:33 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Wed, 25 Dec 2013 14:33:09 +0000 (15:33 +0100)
youtube_dl/extractor/zdf.py

index 94594c5d68dfdc01acbb87b8133d14aa8209b52e..829f002cf02f9c908a5057ab3c6b20f520e2f2ea 100644 (file)
@@ -1,10 +1,10 @@
 # coding: utf-8
 
-import operator
 import re
 
 from .common import InfoExtractor
 from ..utils import (
+    int_or_none,
     unified_strdate,
 )
 
@@ -67,7 +67,7 @@ class ZDFIE(InfoExtractor):
             ''', format_id)
 
             ext = format_m.group('container')
-            proto = format_m.group('proto')
+            proto = format_m.group('proto').lower()
 
             quality = fnode.find('./quality').text
             abr = int(fnode.find('./audioBitrate').text) // 1000
@@ -85,11 +85,11 @@ class ZDFIE(InfoExtractor):
                 'vcodec': format_m.group('vcodec'),
                 'abr': abr,
                 'vbr': vbr,
-                'width': int(fnode.find('./width').text),
-                'height': int(fnode.find('./height').text),
-                'filesize': int(fnode.find('./filesize').text),
+                'width': int_or_none(fnode.find('./width').text),
+                'height': int_or_none(fnode.find('./height').text),
+                'filesize': int_or_none(fnode.find('./filesize').text),
                 'format_note': format_note,
-                'protocol': format_m.group('proto').lower(),
+                'protocol': proto,
                 '_available': is_available,
             }