From a9fc46dc7cd785c583402f933bbca1cc949caf1c Mon Sep 17 00:00:00 2001 From: Mozi <29089388+pzhlkj6612@users.noreply.github.com> Date: Sat, 16 Nov 2024 07:04:10 +0000 Subject: [PATCH] use 'filter' in traversal --- yt_dlp/extractor/rts.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yt_dlp/extractor/rts.py b/yt_dlp/extractor/rts.py index cea1843bc2..09a73c20bf 100644 --- a/yt_dlp/extractor/rts.py +++ b/yt_dlp/extractor/rts.py @@ -242,9 +242,9 @@ class RTSIE(SRGSSRIE): media_list = [] article_details = self._search_json(r'articleDetails\s*=\s*', webpage, 'article details', display_id) - traverse_obj(article_details, ('mainMedia', {lambda x: media_list.append(x) if x else None})) - traverse_obj(article_details, ('innerMediaElements', {lambda x: media_list.extend(x)})) - traverse_obj(article_details, ('mediaElements', {lambda x: media_list.extend(x)})) + traverse_obj(article_details, ('mainMedia', filter, {media_list.append})) + traverse_obj(article_details, ('innerMediaElements', filter, {media_list.extend})) + traverse_obj(article_details, ('mediaElements', filter, {media_list.extend})) media_list = orderedSet(media_list) entries = []