Results 1 to 1 of 1
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Oct 2005
RSS, I want to be proper, but I dont know how...
I was toying with RSS yesterday and I wrote a small script to act as an RSS reader. Now I need some help, I dont know if this is the proper way to do things:
My main question is this. If we are creating an RSS ticker, it has to go out and get a fresh copy of the rss file ever so often(Am I correct on this?). In my case I made it every ten minutes. What is the appropriate delay?
Thanks in advance for any help.
#!/usr/local/bin/ruby require 'net/http' require 'rexml/document' while 1 system("clear") puts "The Latest CNN Headlines:" con = Net::HTTP.start("rss.cnn.com", 80) resp, data = con.get("/rss/cnn_latest.rss") con.finish #data now contains the xml file #parse the xml file news = REXML::Document.new(data) #report the headlines news.elements.each("//item/title") do |item| puts puts item.text end #wait 10 minutes sleep 600 end