Compare commits

...

2 Commits

Author SHA1 Message Date
blueowl04
40f5f610bf
Merge 2bbe273a81 into 71223bff39 2024-08-03 11:52:03 +08:00
Jiří Klimeš
2bbe273a81 [youtube] add published_time for --flat_playlist JSON
It is very desirable to have information about video age too.

Example:
  youtube-dl --flat-playlist -j ytsearch10:"egg recipe"
2022-08-29 22:16:11 +02:00

View File

@ -338,6 +338,8 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
renderer, renderer,
(lambda x: x['ownerText']['runs'][0]['text'], (lambda x: x['ownerText']['runs'][0]['text'],
lambda x: x['shortBylineText']['runs'][0]['text']), compat_str) lambda x: x['shortBylineText']['runs'][0]['text']), compat_str)
published_time = try_get(
renderer, lambda x: x['publishedTimeText']['simpleText'], compat_str) or ''
return { return {
'_type': 'url', '_type': 'url',
'ie_key': YoutubeIE.ie_key(), 'ie_key': YoutubeIE.ie_key(),
@ -348,6 +350,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
'duration': duration, 'duration': duration,
'view_count': view_count, 'view_count': view_count,
'uploader': uploader, 'uploader': uploader,
'published_time': published_time,
} }
def _search_results(self, query, params): def _search_results(self, query, params):