简体   繁体   English

这是用Rails解析RSS / Atom feed的最佳方法

[英]Which is the best way to parsing RSS/Atom feeds with Rails

I'm developing feed reader application in Rails. 我正在Rails中开发提要阅读器应用程序。 And i'm new to feed. 而且我是新来的饲料。 I've a some questions. 我有一些问题。

  1. Which is the best way to parsing thousand of RSS/Atom feeds with Rails or JavaScript /jQuery/ ? 哪种方法是使用Rails或JavaScript / jQuery /解析数千个RSS / Atom提要的最佳方法?
  2. Is there any way to get just feed title / not load whole feed / ? 有什么方法可以只获取供稿标题/不加载整个供稿/?
  3. Is there any way to get feed with limit ? 有什么办法可以限制饲料吗?

Thanks in advance! 提前致谢!

I can highly recommend feedzirra (it's a gem, really). 我可以强烈推荐feedzirra(这确实是一颗宝石)。 I currently use FeedZirra in a production system that is continuously importing thousands of RSS and Atom feeds. 我目前在生产系统中使用FeedZirra,该系统不断导入数千个RSS和Atom提要。 It's very easy to use as well. 它也非常易于使用。

To your other points: no and no. 对于您的其他观点:不,不。 A feed is a file on the web, which you need to download completely. 提要是网络上的文件,您需要完全下载。 You can however limit the number of articles you read or import into your database in your own code. 但是,您可以使用自己的代码来限制阅读或导入数据库的文章数量。

You need to parse the entire file, but it's possible to extract just the titles from each article. 您需要解析整个文件,但是可以从每篇文章中仅提取标题。

Again, feedzirra makes this really easy for you to do. 同样,feedzirra使此操作确实非常容易。

http://github.com/pauldix/feedzirra/tree/master http://github.com/pauldix/feedzirra/tree/master

The best way to do feed processing is to not do it and rely on a 3rd party Feed API. 进行提要处理的最佳方法是不执行提要,而是依靠第三方提要API。 If you wan to do it yourself, you'll have to handle and maintain an offline process and/or queue system to fetch and parse the feed asynchronously. 如果您想自己做,则必须处理和维护一个脱机流程和/或队列系统,才能异步获取和解析提要。 It's usually is a lot of work and adds little value to your project. 通常这是很多工作,并且对您的项目没有多大价值。 You should use an API for this such as Google's API or Superfeedr's feed API . 为此,您应该使用一个API,例如Google的APISuperfeedr的feed API

We created a Rails Engine to consume RSS feed thru Superfeedr. 我们创建了一个Rails Engine来通过Superfeedr 使用RSS feed。 It lets you subscribe, unsubscribe, retrieve past content from feeds and handles notifications of new content on your behalf. 它使您可以订阅,取消订阅,从提要中检索过去的内容,并代表您处理新内容的通知。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM