2011-04-19 114 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