Class: Maimailog::Crawler::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/maimailog/crawler/base.rb

Direct Known Subclasses

History, Status

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



5
6
7
# File 'lib/maimailog/crawler/base.rb', line 5

def initialize
  @agent = Mechanize.new
end

Instance Method Details

#login(id, password) ⇒ Object

maimainet にログインを試みる成功したら home 画面ページが返る



12
13
14
15
16
17
18
19
# File 'lib/maimailog/crawler/base.rb', line 12

def (id, password)
  page = @agent.get('https://maimai-net.com/maimai-mobile/login.html')
  form = page.forms[0]
  form.segaid = id
  form.passwd = password
  button = form.button_with(value: 'Sid Login')
  @agent.submit(form, button)
end