diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2014-08-10 13:04:45 +0200 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2014-08-10 13:04:45 +0200 |
commit | 9572013de9b994e2c20e972f13ce0a54cbd3f886 (patch) | |
tree | 258fa976bc3108fa3117b5efbeb04b5b73613786 | |
parent | 3a5beb0ca149cd0b1df5b29984033e20ccb85a61 (diff) |
[appletrailers] Support height-less videos
-rw-r--r-- | youtube_dl/extractor/appletrailers.py | 5 | ||||
-rw-r--r-- | youtube_dl/utils.py | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/youtube_dl/extractor/appletrailers.py b/youtube_dl/extractor/appletrailers.py index dc8657b67..4359b88d1 100644 --- a/youtube_dl/extractor/appletrailers.py +++ b/youtube_dl/extractor/appletrailers.py @@ -6,6 +6,7 @@ import json from .common import InfoExtractor from ..utils import ( compat_urlparse, + int_or_none, ) @@ -110,8 +111,8 @@ class AppleTrailersIE(InfoExtractor): formats.append({ 'url': format_url, 'format': format['type'], - 'width': format['width'], - 'height': int(format['height']), + 'width': int_or_none(format['width']), + 'height': int_or_none(format['height']), }) self._sort_formats(formats) diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 9b94407f4..65b492fb3 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -1273,8 +1273,11 @@ def int_or_none(v, scale=1, default=None, get_attr=None, invscale=1): if get_attr: if v is not None: v = getattr(v, get_attr, None) + if v == '': + v = None return default if v is None else (int(v) * invscale // scale) + def str_or_none(v, default=None): return default if v is None else compat_str(v) |