mirror of
https://github.com/feeddeck/feeddeck.git
synced 2026-04-29 02:50:34 -05:00
[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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user