2011-04-19 110 views

回答

10

尝试this。这是一个实时的RSS解析器教程。请享用。

4

尝试node-rss。虽然它不稳定,但您应该可以使用它来编写您自己的RSS解析器。

/********************************************************************** 
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 
     ); 
    } 
}); 
1

不确定实时..我所见到的大多数人使用的setTimeout如下面的例子轮询RSS网址..

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

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

或者你可以尝试使用任务队列一样Node-Resque

但这里有几个库,你可以从源代码..

A simple node.js rss parser using sax-jsNode FeedParser

我找到了一个不错的介绍到节点JS包括RSS解析例子.. Here

当我通过我的项目,我会更新这个答案与任何新的调查结果..希望这会有所帮助。

+0

任何新的发现? – zipp 2015-07-21 18:48:52