Hello all,
I have a requirement where I need to monitor a RSS feed.Once there is an update,I need t parse the title and content and store it in my DB table? Is this possible? Any ideas? Would appreciate any help.
Thanks Rails junkie
Hello all,
I have a requirement where I need to monitor a RSS feed.Once there is an update,I need t parse the title and content and store it in my DB table? Is this possible? Any ideas? Would appreciate any help.
Thanks Rails junkie
You could use cron and ./script/runner and Hpricot to parse the feed every-so-often and then simply save data to the DB as changes occur.
Hope this helps.
This is how I do it in one of my project that has similar requirements. You have two problems First is to get and parse the rss - trivial
require 'rss'
path = "http://www.b92.net/info/rss/biz.xml"
rssB92biz = RSS::Parser.parse(path) rssB92biz.items.each do|item| puts "====================================================" puts item.title puts item.link puts item.description puts "====================================================" end
Second is to determine the uniqueness of rss item. I will use the link but it's up to you The next is to store the new unique rss item in db witch is like any other model manipulation.
The interesting part is to make this a background task of your application. For that task I have used BackgrounDRb (http:// backgroundrb.rubyforge.org). I hope that I put you on a right course. If you need some more details just ask.
Dejan
Thank you All This really helps and enough to get me started.
As you suggested, everything worked. Thank you. I have one question though. How Do in limit the RSS feed retrieval to only new ones? If I parse a url, and run a loop, it has all the feeds on that url. is there way to restrcit to only updated ones?
Thanks