Created
January 28, 2015 09:25
-
-
Save akimicyu/b9f74be970b5c34e9987 to your computer and use it in GitHub Desktop.
Nexus 9 checker
This file contains 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/local/bin/ruby | |
require 'rubygems' | |
require 'httpclient' | |
require 'clockwork' | |
include Clockwork | |
module Clockwork | |
def check | |
hc = HTTPClient.new | |
sites = [ | |
"https://play.google.com/store/devices/details?id=nexus_9_black_32gb_lte", | |
"https://play.google.com/store/devices/details?id=nexus_9_black_32gb_wifi", | |
"https://play.google.com/store/devices/details?id=nexus_9_black_16gb_wifi", | |
"https://play.google.com/store/devices/details?id=nexus_9_white_32gb_wifi", | |
"https://play.google.com/store/devices/details?id=nexus_9_white_16gb_wifi", | |
] | |
begin | |
sites.each { |url| | |
html = hc.get_content(url) | |
`osascript -e 'display notification "Nexus9在庫あり! #{url}"'` unless (/現在在庫切れです。/ =~ html) | |
} | |
rescue => e | |
puts e.to_s | |
end | |
end | |
handler do |job| | |
self.send(job.to_sym) | |
end | |
every(1.minute, "check") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment