1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-06-27 17:08:32 +00:00

Use traverse_obj to unpack json data

Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
This commit is contained in:
R0hanW 2025-05-05 15:46:12 -04:00 committed by GitHub
parent 9c4772bc12
commit 59979a0680
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -50,10 +50,11 @@ def _real_extract(self, url):
'id': video_id,
'url': 'https://' + self._search_regex(r'redirect\.mp3/(.+)', data['url'], 'video url'),
'vcodec': 'none',
'thumbnail': thumbnail,
'title': title,
'creators': creators,
'description': description,
'duration': duration,
'formats': formats,
**traverse_obj(data, {
'title': ('title', {str}),
'description': ('description', {clean_html}),
'duration': ('duration', {int_or_none}),
'thumbnail': (('image', ('series', 'image')), 'url', {url_or_none}, any),
'creators': ('series', 'author', {str}, filter, all, filter),
}),
}