diff options
author | Sergey M․ <dstftw@gmail.com> | 2017-06-09 00:16:42 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2017-06-09 00:16:42 +0700 |
commit | 1693bebe4d3e605001b1df8b6e1f238c2e3ff897 (patch) | |
tree | 376db6906bce350d54f977b42196b292fdbcade4 | |
parent | 4244a13a1d7420d8e8a2a51bc4e7d2fa17e9f844 (diff) |
[sohu] Fix numeric fields
-rw-r--r-- | youtube_dl/extractor/sohu.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/youtube_dl/extractor/sohu.py b/youtube_dl/extractor/sohu.py index 7da12cef8..a62ed84f1 100644 --- a/youtube_dl/extractor/sohu.py +++ b/youtube_dl/extractor/sohu.py @@ -8,7 +8,11 @@ from ..compat import ( compat_str, compat_urllib_parse_urlencode, ) -from ..utils import ExtractorError +from ..utils import ( + ExtractorError, + int_or_none, + try_get, +) class SohuIE(InfoExtractor): @@ -169,10 +173,11 @@ class SohuIE(InfoExtractor): formats.append({ 'url': video_url, 'format_id': format_id, - 'filesize': data['clipsBytes'][i], - 'width': data['width'], - 'height': data['height'], - 'fps': data['fps'], + 'filesize': int_or_none( + try_get(data, lambda x: x['clipsBytes'][i])), + 'width': int_or_none(data.get('width')), + 'height': int_or_none(data.get('height')), + 'fps': int_or_none(data.get('fps')), }) self._sort_formats(formats) |