From 388bc9c97c32df1b66b4379418787d922c569687 Mon Sep 17 00:00:00 2001 From: Kyle Gonsalves Date: Fri, 26 Apr 2024 12:47:09 -0700 Subject: [PATCH] suggestions --- yt_dlp/extractor/bbc.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/yt_dlp/extractor/bbc.py b/yt_dlp/extractor/bbc.py index 990640d2b..0d42daf26 100644 --- a/yt_dlp/extractor/bbc.py +++ b/yt_dlp/extractor/bbc.py @@ -17,7 +17,6 @@ int_or_none, join_nonempty, js_to_json, - merge_dicts, parse_duration, parse_iso8601, parse_qs, @@ -1391,26 +1390,27 @@ def parse_media(media): media_data = traverse_obj(simorgh_data, ( 'pageData', 'promo', 'media', {lambda x: x if x['id'] == block_id else None})) - formats = traverse_obj(media_data, ('playlist', lambda _, v: v['url'], { + formats = traverse_obj(media_data, ('playlist', lambda _, v: url_or_none(v['url']), { 'url': ('url', {url_or_none}), 'ext': ('format', {str}), 'tbr': ('bitrate', {k_int_or_none}), - }, {lambda u: u.get('url') and u})) + })) if formats: - entry = merge_dicts({ + entry = { 'id': block_id, 'display_id': playlist_id, 'formats': formats, - }, traverse_obj(simorgh_data, ('pageData', 'promo', { - 'description': ('summary', {str}), - })), traverse_obj(model, { - 'title': ('title', {str}), - 'thumbnail': ('imageUrl', {lambda u: urljoin(url, u.replace('$recipe', 'raw'))}), - 'description': ( + **traverse_obj(simorgh_data, ('pageData', 'promo', { + 'description': ('summary', {str}), + })), + **traverse_obj(model, { + 'title': ('title', {str}), + 'thumbnail': ('imageUrl', {lambda u: urljoin(url, u.replace('$recipe', 'raw'))}), + 'description': ( 'synopses', ('long', 'medium', 'short'), {str}, any), - 'timestamp': ('firstPublished', {k_int_or_none}), - }), - ) + 'timestamp': ('firstPublished', {k_int_or_none}), + }), + } done = True if entry: entries.append(entry)