Skip to content

Instantly share code, notes, and snippets.

@grantmichaels
Created June 26, 2010 15:40
Show Gist options
  • Save grantmichaels/454136 to your computer and use it in GitHub Desktop.
Save grantmichaels/454136 to your computer and use it in GitHub Desktop.
#-*- coding: utf-8 -*-
require 'rubygems'
require 'mechanize'
require 'kconv'
agent = Mechanize.new
agent.get('https://login.keio.jp/koid/')
agent.page.form_with(:action => 'login') do |form|
form.field_with(:name => 'SignOnID').value = "my user ID"
form.field_with(:name => 'Passwd').value = "my passwd"
form.click_button
end
puts agent.page.uri
agent.page.form_with(:action => 'https://www2.adst.keio.ac.jp/rishu/servlet/'
+ 'jp.ac.keio.ess.adst.servlet.view.PortalAuthenticateServlet') do |form|
form.click_button
end
puts agent.page.uri, agent.page.title
agent.page.form_with(:action => '../servlet/jp.ac.keio.ess.adst.servlet.view.GakujiTopMen'
+ 'uServlet?param=adst') do |form|
k = form.button_with(:name => 'ATM001PbNoLectureCheck')
form.click_button(button = k)
end
puts agent.page.uri, agent.page.title
agent.page.form_with(:action => '../servlet/jp.ac.keio.ess.adst.'
+ 'servlet.view.NoLectureCheckServlet?param=adst') do |form|
form.click_button
end
puts agent.page.uri, agent.page.title
r = agent.page.search('div.Message').inner_text.toutf8
puts r, r.include?("休講情報はありません") ? "No":"Yes"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment