在Ruby / Rails中解析Atom和RSS?

问题描述 投票:29回答:7

我正在寻找能让我在Ruby和Rails中解析Atom和RSS的东西。我看过标准的RSS库,但是有一个库可以自动检测它是什么类型的Feed并为我解析它吗?

ruby-on-rails ruby rss atom-feed
7个回答
31
投票

Feedzirra是更好的选择之一:http://www.pauldix.net/2009/02/feedzirra-a-ruby-feed-library-built-for-speed.html

当然,自从我写这篇文章以后,我就有了偏见。 :)


11
投票

Google将揭示一些事情。他们不被接受吗?

Simple RSS Ruby-Feedparser

require 'simple-rss'
require 'open-uri'
rss = SimpleRSS.parse open('http://slashdot.org/index.rdf')
rss.channel.title # => "Slashdot"

11
投票

如果遇到糟糕的Feed,您可能需要使用HPricot来解析Feed。


2
投票

看起来在2009年standart Ruby RSS library刚刚不存在?


2
投票

Feed Normalizer看起来可能是一个不错的选择

https://github.com/aasmith/feed-normalizer


1
投票

我喜欢使用niokrigi或scrapi来解析atom / rss feed中的xml。 http://www.rubyinside.com/nokogiri-ruby-html-parser-and-xml-parser-1288.html


1
投票

我尝试过Feedzirra和SimpleRSS,我发现两者都很好用。 Feedzirra虽然速度更快,但如果你正在寻找它的性能,那么你最好使用Feedzirra。

© www.soinside.com 2019 - 2024. All rights reserved.