node-xml2js icon indicating copy to clipboard operation
node-xml2js copied to clipboard

Loading XML from RSS feed.

Open theasteve opened this issue 7 years ago • 1 comments

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?

theasteve avatar Mar 04 '19 19:03 theasteve

is it a podcast? can you use menoncello/podcast-parser?

chepe263 avatar May 26 '20 22:05 chepe263