Created
August 16, 2010 14:24
-
-
Save shoover/527018 to your computer and use it in GitHub Desktop.
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 '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