Skip to content

Instantly share code, notes, and snippets.

@ohnishiakira
Created April 21, 2011 21:27
Show Gist options
  • Save ohnishiakira/935531 to your computer and use it in GitHub Desktop.
Save ohnishiakira/935531 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# coding: utf-8
require "firewatir"
require "notify"
b = Watir::Browser.new
user = "ohnishiakira" # 入力する名前
user_ja = "おおにしあきら" # 発音する名前
Signal.trap("INT") {
b.close
exit
}
while true
b.goto("shindanmaker.com/" + (rand * 100000).to_i.to_s)
next if "エラー" == b.title.toutf8
b.text_field(:class, "shindanuser").set(user)
b.button(:type, "submit").click
t = b.title.toutf8
s = b.div(:class, "result").text.toutf8
puts "[#{t}]#{s} #{b.url}"
Notify.notify(t, s)
system("SayKotoeri \"#{t} #{s.sub(user, user_ja)}\"")
sleep 3
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment