Hemanth's Scribes

web

RSS as JSON Using node.js

Author Photo

Hemanth HM

Thumbnail

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!

#javascript#linux
Author Photo

About Hemanth HM

Hemanth HM is a Sr. Machine Learning Manager at PayPal, Google Developer Expert, TC39 delegate, FOSS advocate, and community leader with a passion for programming, AI, and open-source contributions.