Want to stay on top? Ruby Weekly is a once-weekly e-mail newsletter covering the latest Ruby and Rails news.
     Feed Icon

How to parse any RSS feed in seconds with Ruby

By Peter Cooper / June 8, 2006

It's quick and easy (to do, not necessarily to parse!).

Step one: Install the FeedTools gem with gem install feedtools

Step two: Use the following code:

require 'rubygems'
require_gem 'feedtools'

feed = FeedTools::Feed.open('http://www.petercooper.co.uk/index.rdf')

puts "Feed title is #{feed.title}"

feed.items.each do |item|
  puts "#{item.title} - #{item.link}"
end

Step three: Learn more with the official tutorial and API documentation.

Step four: You are now the King of all feeds.

Other Posts to Enjoy

Twitter Mentions