projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
3b1dfc0
)
[nytimes] Improve file size extraction
author
Sergey M․
<dstftw@gmail.com>
Fri, 2 May 2014 20:11:38 +0000
(
03:11
+0700)
committer
Sergey M․
<dstftw@gmail.com>
Fri, 2 May 2014 20:11:38 +0000
(
03:11
+0700)
youtube_dl/extractor/nytimes.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/nytimes.py
b/youtube_dl/extractor/nytimes.py
index 07d4deee2564d67b6fdc1cd551913eec0bafd1ea..7bf105d38178a5d59339d81262649b40fa57a46e 100644
(file)
--- 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])
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'],
formats = [
{
'url': video['url'],
@@
-45,7
+53,7
@@
class NYTimesIE(InfoExtractor):
'vcodec': video['video_codec'],
'width': video['width'],
'height': video['height'],
'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)
} for video in video_data['renditions']
]
self._sort_formats(formats)