1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-07-17 18:58:35 +00:00

Use traverse_obj to check url before adding to subtitles

Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
This commit is contained in:
flanter21 2025-07-16 16:18:09 +03:00 committed by GitHub
parent e17f38f5ac
commit ec64564c2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -136,8 +136,8 @@ def _real_extract(self, url):
'url': subs['url'],
})
for current_chat in video_info.get('chats'):
subtitles.setdefault('live_chat', []).append({'url': url_or_none(current_chat['url'])})
for live_chat_url in traverse_obj(video_info, ('chats', ..., 'url', {url_or_none})):
subtitles.setdefault('live_chat', []).append({'url': live_chat_url})
return {
**traverse_obj(video_info, {