Node.js RSS 模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5722638/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 14:03:06  来源:igfitidea点击:

Node.js RSS module

rssnode.js

提问by donald

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

有没有办法使用 Node.js 实时读取 RSS 提要?

Thanks

谢谢

采纳答案by Pono

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

试试这个。这是一个实时 RSS 解析器教程。享受。

回答by Behnam Shomali

回答by Raynos

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

试试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
        );
    }
});

回答by tk120404

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

试试这个,这也会解析 rss、atom 和 feedburner

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

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

回答by John Drefahl

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

不确定实时性。我见过大多数人使用 SetTimeout 轮询 RSS URL,如下例所示。

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.

或者您可以尝试使用像Node-Resque这样的任务队列。

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

但是这里有几个你可以从中获取的库。

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

使用 sax-jsNode FeedParser 的简单 node.js rss 解析器

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

我发现了一个非常好的 Node JS 介绍,其中包括一个 RSS 解析示例..这里

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

当我完成我的项目时,我会用任何新发现更新这个答案..希望这会有所帮助。