node-xml2js
node-xml2js copied to clipboard
Loading XML from RSS feed.
I'm trying to load XML from an RSS feed. I'm using rss-parser to turn the rss feed url into JSON. However, the JSON response I get back leaves out the namespaces.
I'n order to grab the namespaces I have to hardcode them in via the customFields options. I would like to use node-xml2js to parse the XML directly from a rss feed URL. Is there any way to go about doing that using node-xml2js?
I tried using url library as follow:
const url = require('url');
const xml2js = require('xml2js');
var parser = new xml2js.Parser();
const convertRssIntoJson = rssFeed => {
return new Promise((res, rej) => {
url.parse(rssFeed, (err, rss) => {
parser.parseString(rss, function (err, result) {
console.dir(result);
console.log(result);
});
});
});
};
convertRssIntoJson('https://www.nycgovparks.org/web/events/controller/rss.php?qs=c18');
Is there any way to parse the XML from a RSS feed or load the XML from a URL?
is it a podcast? can you use menoncello/podcast-parser?