Skip to content

Instantly share code, notes, and snippets.

@makimoto
Created August 6, 2010 02:45
Show Gist options
  • Save makimoto/510758 to your computer and use it in GitHub Desktop.
Save makimoto/510758 to your computer and use it in GitHub Desktop.
#!/usr/env ruby
# vim:fileencoding=utf-8
require "rubygems"
require "mechanize"
id = "[email protected]"
pwd = "password"
agent = Mechanize.new
agent.post_connect_hooks << Proc.new {|params|
params[:response_body] = NKF.nkf("-wm0S",params[:response_body]).sub(/Shift_JIS/,"utf-8")
params[:response]["Content-Type"] = "text/html; charset=utf-8"
}
page = agent.get("https://www.kakuyasu.co.jp/ec/common/CSfLogin.jsp")
page.forms[1].ID = id
page.forms[1].PWD = pwd
agent.submit(page.forms[1])
page = agent.get("http://www.kakuyasu.co.jp/ec/disp/CSfLastGoodsPage_001.jsp?GOODS_NO=10388")
if page.body =~ /【1ケース\(24本入り\)】[\s\S]+エリア内なら2時間枠/
`/usr/local/bin/growlnotify -t '#{Time.now}' -m 'ウィルキンソンジンジャエール在庫あります'`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment