require 'rss' p RSS:VERSION
rss = RSS::Parser.parse('http://www.softantenna.com/rss.xml')
rss.items.each do |item|
print item.title
end
rss = RSS::Parser.parse(File.read('rss.xml'))rss = RSS::Parser.parse('rss.xml') # Try to get the XML associated with +rss+.
# Return +rss+ if it already looks like XML, or treat it as a URI,
# or a file to get the XML,
def normalize_rss(rss)
return rss if maybe_xml?(rss)
uri = to_uri(rss)
if uri.respond_to?(:read)
uri.read
elsif !rss.tainted? and File.readable?(rss)
File.open(rss) {|f| f.read}
else
rss
end
end
※rssファイルの種類によって(RSSのバージョン違い)によってparse()の呼び出しで戻されるオブジェクトが異なる。