From b52c912a45ef278a0fa0455c9329eb3c118219df Mon Sep 17 00:00:00 2001 From: Damiano Amatruda Date: Sun, 20 Nov 2022 14:09:37 +0100 Subject: [PATCH] [extractor/generic] Support Dublin Core in RSS --- yt_dlp/extractor/generic.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/yt_dlp/extractor/generic.py b/yt_dlp/extractor/generic.py index d39fe12585..556d9619d5 100644 --- a/yt_dlp/extractor/generic.py +++ b/yt_dlp/extractor/generic.py @@ -2192,6 +2192,7 @@ def report_detected(self, name, num=1, note=None): def _extract_rss(self, url, video_id, doc): NS_MAP = { 'itunes': 'http://www.itunes.com/dtds/podcast-1.0.dtd', + 'dc': 'http://dublincore.org/specifications/dublin-core/dcmes-xml/2001-04-11/dcmes-xml-dtd.dtd', } entries = [] @@ -2208,12 +2209,15 @@ def _extract_rss(self, url, video_id, doc): def itunes(key): return xpath_text(it, xpath_with_ns(f'./itunes:{key}', NS_MAP), default=None) + def dc(key): + return xpath_text(it, xpath_with_ns(f'./dc:{key}', NS_MAP), default=None) + entries.append({ '_type': 'url_transparent', 'url': next_url_new, 'title': try_call(lambda: it.find('title').text), 'description': xpath_text(it, 'description', default=None), - 'uploader': xpath_text(it, 'author', default=None), + 'uploader': xpath_text(it, 'author', default=None) or itunes('author') or dc('creator'), 'timestamp': unified_timestamp(xpath_text(it, 'pubDate', default=None)), 'duration': parse_duration(itunes('duration')), 'thumbnail': url_or_none(xpath_attr(it, xpath_with_ns('./itunes:image', NS_MAP), 'href')),