Created
August 6, 2013 16:18
-
-
Save wildjcrt/6166024 to your computer and use it in GitHub Desktop.
自動檢查 registrano 報名資訊,讓我在 10 小時前成功加入台灣零時政府第壹次公地放領黑客松的小程式。
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
# encoding: utf-8 | |
# $ ruby check_bot.rb | |
require 'open-uri' | |
@url = 'https://registrano.com/events/handlino-new-opening/registrations/new' | |
def check? | |
open(@url) do |f| | |
f.each_line do |line| | |
if line.include? '抱歉,目前本活動已額滿。' | |
puts '抱歉,目前本活動已額滿。' | |
return false | |
end | |
end | |
end | |
end | |
while(1) do | |
system("open #{@url}") if check? | |
sleep 60 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment