Skip to content

Instantly share code, notes, and snippets.

@talhasyed
Created May 5, 2011 20:10
Show Gist options
  • Save talhasyed/957817 to your computer and use it in GitHub Desktop.
Save talhasyed/957817 to your computer and use it in GitHub Desktop.
Test RSS Feed
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'redis'
r = Redis.new
r.select("1")
loop do
doc = Nokogiri::XML(open("http://blogs.thescore.com/tbj/feed/?#{rand(1000)}=#{rand(1000)}"))
item = doc.xpath(".//channel//item[title='The Lakers need marriage counseling']//media:thumbnail").first rescue nil
url = item.nil? ? "blank" : item.attributes["url"]
puts url
r.sadd("urls", url)
sleep(2)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment