我可以使用Ruby内置的RSS模块来读取原子提要吗?

时间:2010-12-13 19:19:38

标签: ruby parsing feed atom-feed

我所处的环境中无法安装任何宝石。我只有标准的ruby(版本:1.8.7)安装。

我正在尝试这样的事情:


require 'rss/1.0'
require 'rss/2.0'
require 'open-uri'

source = "http://www.example.com/feed.atom" # url or local file
content = "" # raw content of rss feed will be loaded here
open(source) do |s| content = s.read end
rss = RSS::Parser.parse(content, false)
        

当我解析内容时,我收到了零。所以我想知道内置的RSS模块是否支持解析原子提要。

2 个答案:

答案 0 :(得分:0)

如果你在RSS::Maker下查看可解析的内容。

答案 1 :(得分:0)

作为替代方案,请考虑尝试nokogiri gem。