Browse Source

[appletrailers] Support height-less videos

totalwebcasting
Philipp Hagemeister 10 years ago
parent
commit
9572013de9
2 changed files with 6 additions and 2 deletions
  1. +3
    -2
      youtube_dl/extractor/appletrailers.py
  2. +3
    -0
      youtube_dl/utils.py

+ 3
- 2
youtube_dl/extractor/appletrailers.py View File

@ -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)


+ 3
- 0
youtube_dl/utils.py View File

@ -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)


Loading…
Cancel
Save