Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
feedhandler
Advanced tools
An extensible rss/rdf/atom parser
Weekly downloads
Readme
An extensible RSS/RDF/Atom feed parser for use with html-parser2.
Assuming the following RSS, with a custom my:tag
you want to extract into your object model
<?xml version="1.0"?>
<rss version="2.0" xmlns:my="http://example.com/my">
<channel>
<title>Liftoff News</title>
<link>http://liftoff.msfc.nasa.gov/</link>
<description>Liftoff to Space Exploration.</description>
<language>en-us</language>
<pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>
<lastBuildDate>Tue, 10 Jun 2003 09:41:01 GMT</lastBuildDate>
<item>
<title>Star City</title>
<link>http://liftoff.msfc.nasa.gov/news/2003/news-starcity.asp</link>
<description>How do Americans get ready to work with Russians aboard the International Space Station? They take a crash course in culture, language and protocol at Russia's <a href="http://howe.iki.rssi.ru/GCTC/gctc_e.htm">Star City</a>.</description>
<pubDate>Tue, 03 Jun 2003 09:39:21 GMT</pubDate>
<guid>http://liftoff.msfc.nasa.gov/2003/06/03.html#item573</guid>
<!-- custom extension to RSS payload -->
<my:tag>So glad I could sneak this new content in</my:tag>
</item>
</channel>
</rss>
You can extract the value of the custom tag using the extensions
property.
var htmlparser2 = require('htmlparser2');
var FeedHandler = require('feedhandler');
function parse(xml, cb) {
var handler = new FeedHandler(cb, {
extensions: [
{input: "my:tag", output: "my_tag"}
]
});
try {
new htmlparser2.Parser(handler, {xmlMode: true}).parseComplete(xml);
} catch (ex) {
cb(ex);
}
}
module.exports = parse;
Running parse
against the xml sample will return the following object:
{
type: "rss",
id: "",
title: "Liftoff News",
link: "http://liftoff.msfc.nasa.gov/",
description: "Liftoff to Space Exploration.",
updated: new Date("Tue, 10 Jun 2003 09:41:01 GMT"),
items: [{
id: "http://liftoff.msfc.nasa.gov/2003/06/03.html#item573",
title: "Star City",
link: "http://liftoff.msfc.nasa.gov/news/2003/news-starcity.asp",
description: "How do Americans get ready to work with Russians aboard the International Space Station? They take a crash course in culture, language and protocol at Russia's <a href=\"http://howe.iki.rssi.ru/GCTC/gctc_e.htm\">Star City</a>.",
pubDate: new Date("Tue, 03 Jun 2003 09:39:21 GMT"),
my_tag: "So glad I could sneak this new content in"
}]
}
FAQs
An extensible rss/rdf/atom parser
The npm package feedhandler receives a total of 89 weekly downloads. As such, feedhandler popularity was classified as not popular.
We found that feedhandler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.