Skip to content

Instantly share code, notes, and snippets.

@supermomonga
Created July 1, 2013 05:22
Show Gist options
  • Save supermomonga/5898527 to your computer and use it in GitHub Desktop.
Save supermomonga/5898527 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
require 'rubygems'
require 'mechanize'
# Settings
email = '[email protected]'
passwd = 'hoge'
# Initialize
agent = Mechanize.new
agent.verify_mode = OpenSSL::SSL::VERIFY_NONE
agent.user_agent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X; ja-jp) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25'
agent.max_history = 10
# login
agent.get('https://ssl.sp.mbga.jp/_lg')
agent.page.form_with(:action => 'https://ssl.sp.mbga.jp/_lg') do |form|
form.field_with(:name => 'login_cb').value = '/_game_my_redirect?g=12008305'
form.field_with(:name => 'login_id').value = email
form.field_with(:name => 'login_pw').value = passwd
form.click_button
end
# get trades
# agent.get('http://sp.pf.mbga.jp/12008305/?url=http://125.6.169.35/idolmaster/auction/search_top/0/3400201')
agent.get('http://sp.pf.mbga.jp/12008305/?url=http://125.6.169.35/idolmaster/auction/history/3400201?rnd=863573906')
trades = agent.page.search('span.yellow')
trades.each do |t|
puts t.inner_text
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment