DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Read And Parse RSS Feed

  • submit to reddit
require 'open-uri'

require 'rss/0.9'
require 'rss/1.0'
require 'rss/2.0'
require 'rss/parser'

url = ''
rss = RSS::Parser.parse(open(url){|fd|})
puts rss.items.collect{|item|item.title}.join("\n")

See also <a href=''>simple-rss</a> at rubyforge.    


Danny Lagrouw replied on Mon, 2006/01/09 - 5:40am

This code crashed on most feeds I tried to read with it. SimpleRss works very well though!