Skip to content

Instantly share code, notes, and snippets.

@shoover
Created August 16, 2010 14:24
Show Gist options
  • Save shoover/527018 to your computer and use it in GitHub Desktop.
Save shoover/527018 to your computer and use it in GitHub Desktop.
require 'open-uri'
require 'hpricot'
url = "http://www.lowes.com/webapp/wcs/stores/servlet/ProductDisplay?storeId=10151&catalogId=10051&productId=3200897"
cookie = "selectedStore1=Lowe's Of C Indianapolis## IN|0635|2|46220|no|Y|6002 North Rural Street|Indianapolis|M-Sa 6:30 Am - 10 Pm## Su 8 Am - 8 Pm|(317) 202-9142|(317) 202-9543|OA"
open(url, "Cookie" => cookie) do |f|
xml = Hpricot.XML(f)
text = (xml/"#buy-now").first.inner_text
if text =~ /Unavailable at LOWE'S OF C. INDIANAPOLIS/i
puts "Nope"
else
puts "THEY HAVE IT! THEY HAVE IT!"
$stdin.gets
cmd = url.gsub /&/, '^&'
system "start #{cmd}"
end
end
if ARGV.include? "--wait"
$stdin.gets
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment