Created
May 5, 2011 20:10
-
-
Save talhasyed/957817 to your computer and use it in GitHub Desktop.
Test RSS Feed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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