s

Parsing an RSS feed with Ruby

Jun 09, 2007

Parsing an RSS feed is insanely simple with Ruby. Two lines is all it takes. . .

require 'rss'
rss = RSS::Parser.parse(open('/feed/posts/index.html').read, false)

Now you'll have an Array of the results, so you can do something like:

rss.items.each { |i| puts "#{i.title} - #{i.date}" }

Tagged: rubyrsstutorial