[rss] Parse Atom and RDF Feeds from Websites (#99)

Until now we only checked if a website contained a RSS feed which can be
used for FeedDeck. Now we are also checking if the website contains a
Atom or RDF feed when no RSS feed was found.

For this we are checking `link` tag with the `type="application/atom+xml"`
attribute or a link tag with the `type="application/rdf+xml"` attribute.
This commit is contained in:
Rico Berger
2023-12-12 20:22:30 +01:00
committed by GitHub
parent 9e59439226
commit 8065e19c85

View File

@@ -202,9 +202,15 @@ const getFeedFromWebsite = async (
const html = await response.text();
const $ = cheerio.load(html);
const rssLink = $('link[type="application/rss+xml"]').attr('href');
let rssLink = $('link[type="application/rss+xml"]').attr('href');
if (!rssLink) {
return undefined;
rssLink = $('link[type="application/atom+xml"]').attr('href');
if (!rssLink) {
rssLink = $('link[type="application/rdf+xml"]').attr('href');
if (!rssLink) {
return undefined;
}
}
}
source.options!.rss = new URL(rssLink, source.options!.rss!).href;