From a825ffbffa0bea322e3ccb44c6f8e01d8d9572fb Mon Sep 17 00:00:00 2001 From: coletdjnz Date: Sat, 12 Mar 2022 11:20:58 +1300 Subject: [PATCH] [extractor] Support merging subtitles with data Authored-by: coletdjnz --- yt_dlp/extractor/common.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index 354814433..345da9a72 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -3651,11 +3651,11 @@ def _get_comments(self, *args, **kwargs): @staticmethod def _merge_subtitle_items(subtitle_list1, subtitle_list2): - """ Merge subtitle items for one language. Items with duplicated URLs + """ Merge subtitle items for one language. Items with duplicated URLs/data will be dropped. """ - list1_urls = set([item['url'] for item in subtitle_list1]) + list1_data = set([item.get('url') or item['data'] for item in subtitle_list1]) ret = list(subtitle_list1) - ret.extend([item for item in subtitle_list2 if item['url'] not in list1_urls]) + ret.extend([item for item in subtitle_list2 if (item.get('url') or item['data']) not in list1_data]) return ret @classmethod