28

Is there a way to read from an RSS feed using Node.js, possibly, in Real-time?

Thanks

donald
  • 23,587
  • 42
  • 142
  • 223

5 Answers5

28

try node-feedparser

Behnam Shomali
  • 863
  • 1
  • 12
  • 14
11

Try this. It's a real-time RSS parser tutorial. Enjoy.

Pono
  • 11,298
  • 9
  • 53
  • 70
4

Try node-rss. It is unstable though but you should be able to use it as an example to write your own RSS parser.

/**********************************************************************
Example One:
Getting a remote RSS feed and parsing
rss.parseURL(feed_url, use_excerpt, callback);
**********************************************************************/
// URL of the feed you want to parse
var feed_url = 'http://feeds.feedburner.com/github';

var response = rss.parseURL(feed_url, function(articles) {
    sys.puts(articles.length);
    for(i=0; i<articles.length; i++) {
    sys.puts("Article: "+i+", "+
         articles[i].title+"\n"+
         articles[i].link+"\n"+
         articles[i].description+"\n"+
         articles[i].content
        );
    }
});
Raynos
  • 166,823
  • 56
  • 351
  • 396
2

Try this, this parses rss,atom and feedburner as well

https://github.com/tk120404/node-rssparser

tk120404
  • 2,985
  • 1
  • 27
  • 28
1

Not sure about realtime.. I have seen most people poll the RSS URLs using SetTimeout like the example below..

function updateFeeds() {
    // Do some work.  Possibly async
    // Call done() when finished.
}

function done() {
    setTimeout( updateFeeds, 1000 * 60 );
}

Or you could try using a Task Queue like Node-Resque.

But here are a couple of libraries that you could source from..

A simple node.js rss parser using sax-js or Node FeedParser

I found a pretty good intro to Node JS that includes a RSS parsing example.. Here

As I make my way through my project, I will update this answer with any new findings.. Hope this helped.

John Drefahl
  • 556
  • 3
  • 17