Sha256: 93df0042223ee3c823e251f1d4f33af777edcbf32b0a053dc8497e3bc0fbd584

Contents?: true

Size: 931 Bytes

Versions: 1

Compression:

Stored size: 931 Bytes

Contents

#! /usr/bin/env ruby
#
# points-rakuten.rb: getting current Rakuten Point
# by scraping www.rakuten.co.jp.
#
# Copyright (C) 2012 by MATSUI Shinsuke <poppen.jp@gmail.com>
# Distributed under GPL.
#

require 'rubygems'
require 'mechanize'
require 'pit'

URL = 'https://point.rakuten.co.jp'

@login = Pit::get( 'rakuten', :require => {
	'user' => 'your ID of rakuten.',
	'pass' => 'your Password of rakuten.'
} )

agent = Mechanize::new
agent.set_proxy( *ENV['HTTP_PROXY'].split( /:/ ) ) if ENV['HTTP_PROXY']

page = agent.get(URL)

login_page = agent.click( page.link_with(:href => /login/i) )
point_page = login_page.form_with(:name => 'LoginForm') do|form|
	form.u = @login['user']
	form.p = @login['pass']
end.click_button

point = point_page.at(
	'//div[@id="pointAccount"]//dl[@class="total"]/dd').text

puts point

# Local Variables:
# mode: ruby
# indent-tabs-mode: t
# tab-width: 3
# ruby-indent-level: 3
# End:
# vim: ts=3

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
points-scraper-0.0.3 bin/points-rakuten