Class: Points::Scraper::TPoint
- Defined in:
- lib/points-scraper/tpoint.rb
Instance Method Summary collapse
Methods inherited from Default
Constructor Details
This class inherits a constructor from Points::Scraper::Default
Instance Method Details
#start ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/points-scraper/tpoint.rb', line 14 def start start_scrape do |agent| agent.user_agent = 'Mozilla/5.0 (Linux; U; Android 2.3.2; ja-jp; SonyEricssonSO-01C Build/3.0.D.2.79) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' agent.get('http://login.yahoo.co.jp/config/login?.lg=jp&.intl=jp&logout=1&.src=www&.done=http://www.yahoo.co.jp') sleep 2 agent.get('https://login.yahoo.co.jp/config/login?.src=www&.done=http://www.yahoo.co.jp') agent.page.form_with(name: 'login_form') do |form| form.field_with(name: 'login').value = @user form.field_with(name: 'passwd').value = @pass agent.page.body =~ /\("\.albatross"\)\[0\]\.value = "(.*)"/ form.field_with(name: '.albatross').value = $1 form. end sleep 2 agent.get('http://points.yahoo.co.jp/') agent.page.at('.ptsPoint').text end end |