Created
November 27, 2012 19:28
-
-
Save tomkersten/4156433 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
#!/usr/bin/env ruby | |
# Do this: | |
# gem install httparty nokogiri | |
# Then run this file... | |
require 'httparty' | |
require 'nokogiri' | |
class HtmlParserIncluded < HTTParty::Parser | |
SupportedFormats.merge!('text/html' => :html) | |
def html | |
Nokogiri::HTML(body) | |
end | |
end | |
class Page | |
include HTTParty | |
parser HtmlParserIncluded | |
end | |
url = 'https://play.google.com/store/devices/details?id=nexus_4_16gb' | |
loop do | |
res = Page.get(url) | |
res.css('span.hardware-sold-out').each {|l| | |
if l.content != "Sold out" | |
puts url | |
`say "Nexus 4 is on sale"` | |
end | |
} | |
sleep 30 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment