1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-06-28 01:18:30 +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, 'id': video_id,
'url': 'https://' + self._search_regex(r'redirect\.mp3/(.+)', data['url'], 'video url'), 'url': 'https://' + self._search_regex(r'redirect\.mp3/(.+)', data['url'], 'video url'),
'vcodec': 'none', 'vcodec': 'none',
'thumbnail': thumbnail, **traverse_obj(data, {
'title': title, 'title': ('title', {str}),
'creators': creators, 'description': ('description', {clean_html}),
'description': description, 'duration': ('duration', {int_or_none}),
'duration': duration, 'thumbnail': (('image', ('series', 'image')), 'url', {url_or_none}, any),
'formats': formats, 'creators': ('series', 'author', {str}, filter, all, filter),
}),
} }