Ruby RSS Parser - Multiple URL's

Lenovo / 6075bqu
September 28, 2010 at 09:47:19
Specs: Windows XP, 2.327 GHz / 3045 MB
Here's what I have so far to grab URL's from a RSS and it seems to be working fine, however, I'd like to be able to have a list of URL's to grab from. I'm not familiar with Ruby, but since I've gotten this far with it, I wouldn't mind finishing the script.


require 'rss'
require 'open-uri'

source = "http://example.com/feed.rss"
content = ""
open(source) do |s| content = s.read end
rss = RSS::Parser.parse(content, true)

rss.items.each do |item|
puts item.link
end


See More: Ruby RSS Parser - Multiple URLs

Report •


#1
September 28, 2010 at 17:12:43
If I understand the Q, lots of ways to do this in Ruby.

require 'rss'
require 'open-uri'
DATA.each do |source|
source.chomp!
break if source == ""
content = ""
puts "\t\t#{source}"
open(source) do |s|
content = s.read
end
rss = RSS::Parser.parse(content, true)
rss.items.each do |item|
puts item.link
end
end
#
__END__
http://rubyforge.org/export/rss_sfn...
http://www.kayak.com/h/rss/deals


Report •
Related Solutions


Ask Question