1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-12-23 00:16:48 +00:00

[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"
This commit is contained in:
Jiří Klimeš 2022-08-29 22:09:59 +02:00
parent ed5c44e7b7
commit 2bbe273a81

View File

@ -330,6 +330,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(),
@ -340,6 +342,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):