[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
1 changed files with 3 additions and 0 deletions

View File

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