mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-27 14:15:37 +01:00
[redditr] Extract duration (#27426)
This commit is contained in:
parent
164a4a5756
commit
76fe4ba3b2
|
@ -7,6 +7,7 @@ from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
float_or_none,
|
float_or_none,
|
||||||
|
try_get,
|
||||||
url_or_none,
|
url_or_none,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -59,6 +60,7 @@ class RedditRIE(InfoExtractor):
|
||||||
'timestamp': 1501941939,
|
'timestamp': 1501941939,
|
||||||
'upload_date': '20170805',
|
'upload_date': '20170805',
|
||||||
'uploader': 'Antw87',
|
'uploader': 'Antw87',
|
||||||
|
'duration': 12,
|
||||||
'like_count': int,
|
'like_count': int,
|
||||||
'dislike_count': int,
|
'dislike_count': int,
|
||||||
'comment_count': int,
|
'comment_count': int,
|
||||||
|
@ -123,6 +125,10 @@ class RedditRIE(InfoExtractor):
|
||||||
'thumbnail': url_or_none(data.get('thumbnail')),
|
'thumbnail': url_or_none(data.get('thumbnail')),
|
||||||
'timestamp': float_or_none(data.get('created_utc')),
|
'timestamp': float_or_none(data.get('created_utc')),
|
||||||
'uploader': data.get('author'),
|
'uploader': data.get('author'),
|
||||||
|
'duration': int_or_none(try_get(
|
||||||
|
data,
|
||||||
|
(lambda x: x['media']['reddit_video']['duration'],
|
||||||
|
lambda x: x['secure_media']['reddit_video']['duration']))),
|
||||||
'like_count': int_or_none(data.get('ups')),
|
'like_count': int_or_none(data.get('ups')),
|
||||||
'dislike_count': int_or_none(data.get('downs')),
|
'dislike_count': int_or_none(data.get('downs')),
|
||||||
'comment_count': int_or_none(data.get('num_comments')),
|
'comment_count': int_or_none(data.get('num_comments')),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user