aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/nytimes.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2014-05-03 03:11:38 +0700
committerSergey M․ <dstftw@gmail.com>2014-05-03 03:11:38 +0700
commit65157783050b5d2bee55310e084ab4e5e15c2b1b (patch)
tree8904bf0c49d59b016f1bfdfdb43e2fcfdbbc4c21 /youtube_dl/extractor/nytimes.py
parent3b1dfc0f2f49117c30fab8aef45993ecf99256c2 (diff)
[nytimes] Improve file size extraction
Diffstat (limited to 'youtube_dl/extractor/nytimes.py')
-rw-r--r--youtube_dl/extractor/nytimes.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/youtube_dl/extractor/nytimes.py b/youtube_dl/extractor/nytimes.py
index 07d4deee2..7bf105d38 100644
--- a/youtube_dl/extractor/nytimes.py
+++ b/youtube_dl/extractor/nytimes.py
@@ -38,6 +38,14 @@ class NYTimesIE(InfoExtractor):
uploader = video_data['byline']
timestamp = parse_iso8601(video_data['publication_date'][:-8])
+ def get_file_size(file_size):
+ if isinstance(file_size, int):
+ return file_size
+ elif isinstance(file_size, dict):
+ return int(file_size.get('value', 0))
+ else:
+ return 0
+
formats = [
{
'url': video['url'],
@@ -45,7 +53,7 @@ class NYTimesIE(InfoExtractor):
'vcodec': video['video_codec'],
'width': video['width'],
'height': video['height'],
- 'filesize': video['fileSize'],
+ 'filesize': get_file_size(video['fileSize']),
} for video in video_data['renditions']
]
self._sort_formats(formats)