RSS as JSON using node.js

Lately me and one my hacker buddies we talking about a project plan, in which RSS as JSON was a major module, some simple module mixing from node made the job very easy.

Made a npm package out of it, to install just do npm install rsj

Code for which, is very simple, yet seems to be doing the job as needed so far, the code looks like :

exports.r2j = r2j;
 
var FeedParser = require('feedparser');
parser = new FeedParser();
 
function r2j(uri, cb) {
  parser.parseUrl(uri, function (err, meta, articles) {
    if (err) return console.error(err);
    cb(JSON.stringify(articles));
  });
}

RSS as JSON using nodejs

EXAMPLE USAGE :

rsj = require('rsj');
 
rsj.r2j('http://h3manth.com/rss.xml',function(json) { console.log(json);})

This is kina a baby, still trying to improve, you feedback is always welcomed :) Happy Hacking!

Share this