points-scraper 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ vendor/bundle
data/Gemfile CHANGED
@@ -2,5 +2,3 @@ source :rubygems
2
2
 
3
3
  # Specify your gem's dependencies in points-scraper.gemspec
4
4
  gemspec
5
- gem 'mechanize'
6
- gem 'pit'
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # points-anamileage.rb: getting current mileage
4
+ # by scraping www.ana.co.jp.
5
+ #
6
+ # Copyright (C) 2012 by MATSUI Shinsuke <poppen.jp@gmail.com>
7
+ # Distributed under GPL.
8
+ #
9
+
10
+ require 'rubygems'
11
+ require 'mechanize'
12
+ require 'pit'
13
+
14
+ URL = 'https://www.ana.co.jp/'
15
+
16
+ @login = Pit::get( 'ana', :require => {
17
+ 'user' => 'your ID of ana.',
18
+ 'pass' => 'your Password of ana.'
19
+ } )
20
+
21
+ agent = Mechanize::new
22
+ agent.set_proxy( *ENV['HTTP_PROXY'].split( /:/ ) ) if ENV['HTTP_PROXY']
23
+
24
+ agent.get(URL)
25
+
26
+ agent.page.form_with(:name => 'loginForm') do|form|
27
+ form.custno = @login['user']
28
+ form.password = @login['pass']
29
+ form.click_button
30
+ end
31
+
32
+ agent.page.forms[0].tap do|form|
33
+ form.encoding = 'CP932'
34
+ form.click_button
35
+ end
36
+
37
+ point = agent.page.at('//div[@class="mileInfo_a2"]//span[1]').text
38
+
39
+ puts point
40
+
41
+ # Local Variables:
42
+ # mode: ruby
43
+ # indent-tabs-mode: t
44
+ # tab-width: 3
45
+ # ruby-indent-level: 3
46
+ # End:
47
+ # vim: ts=3
@@ -0,0 +1,43 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # points-rakuten.rb: getting current Rakuten Point
4
+ # by scraping www.rakuten.co.jp.
5
+ #
6
+ # Copyright (C) 2012 by MATSUI Shinsuke <poppen.jp@gmail.com>
7
+ # Distributed under GPL.
8
+ #
9
+
10
+ require 'rubygems'
11
+ require 'mechanize'
12
+ require 'pit'
13
+
14
+ URL = 'https://point.rakuten.co.jp'
15
+
16
+ @login = Pit::get( 'rakuten', :require => {
17
+ 'user' => 'your ID of rakuten.',
18
+ 'pass' => 'your Password of rakuten.'
19
+ } )
20
+
21
+ agent = Mechanize::new
22
+ agent.set_proxy( *ENV['HTTP_PROXY'].split( /:/ ) ) if ENV['HTTP_PROXY']
23
+
24
+ page = agent.get(URL)
25
+
26
+ login_page = agent.click( page.link_with(:href => /login/i) )
27
+ point_page = login_page.form_with(:name => 'LoginForm') do|form|
28
+ form.u = @login['user']
29
+ form.p = @login['pass']
30
+ end.click_button
31
+
32
+ point = point_page.at(
33
+ '//div[@id="pointAccount"]//dl[@class="total"]/dd').text
34
+
35
+ puts point
36
+
37
+ # Local Variables:
38
+ # mode: ruby
39
+ # indent-tabs-mode: t
40
+ # tab-width: 3
41
+ # ruby-indent-level: 3
42
+ # End:
43
+ # vim: ts=3
@@ -1,5 +1,5 @@
1
1
  module Points
2
2
  module Scraper
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -5,13 +5,11 @@ require "points-scraper/version"
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "points-scraper"
7
7
  s.version = Points::Scraper::VERSION
8
- s.authors = ["TADA Tadashi"]
9
- s.email = ["t@tdtds.jp"]
8
+ s.authors = ["TADA Tadashi", "MATSUI Shinsuke"]
9
+ s.email = ["t@tdtds.jp", "poppen.jp@gmal.com"]
10
10
  s.homepage = "https://github.com/tdtds/points-scraper"
11
11
  s.summary = "getting mileages/points from shopping web sites."
12
- s.description = "getting mileages/points by web scraping shopping sites: T-SITE."
13
-
14
- s.rubyforge_project = "points-scraper"
12
+ s.description = "getting mileages/points by web scraping shopping sites: T-SITE, ANA and rakuten."
15
13
 
16
14
  s.files = `git ls-files`.split("\n")
17
15
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
metadata CHANGED
@@ -1,19 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: points-scraper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - TADA Tadashi
9
+ - MATSUI Shinsuke
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2012-02-18 00:00:00.000000000 Z
13
+ date: 2012-03-22 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: mechanize
16
- requirement: &72358050 !ruby/object:Gem::Requirement
17
+ requirement: &72395670 !ruby/object:Gem::Requirement
17
18
  none: false
18
19
  requirements:
19
20
  - - ! '>='
@@ -21,10 +22,10 @@ dependencies:
21
22
  version: '0'
22
23
  type: :runtime
23
24
  prerelease: false
24
- version_requirements: *72358050
25
+ version_requirements: *72395670
25
26
  - !ruby/object:Gem::Dependency
26
27
  name: pit
27
- requirement: &72357840 !ruby/object:Gem::Requirement
28
+ requirement: &72395250 !ruby/object:Gem::Requirement
28
29
  none: false
29
30
  requirements:
30
31
  - - ! '>='
@@ -32,11 +33,15 @@ dependencies:
32
33
  version: '0'
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *72357840
36
- description: ! 'getting mileages/points by web scraping shopping sites: T-SITE.'
36
+ version_requirements: *72395250
37
+ description: ! 'getting mileages/points by web scraping shopping sites: T-SITE, ANA
38
+ and rakuten.'
37
39
  email:
38
40
  - t@tdtds.jp
41
+ - poppen.jp@gmal.com
39
42
  executables:
43
+ - points-anamileage
44
+ - points-rakuten
40
45
  - points-tpoint
41
46
  extensions: []
42
47
  extra_rdoc_files: []
@@ -44,6 +49,8 @@ files:
44
49
  - .gitignore
45
50
  - Gemfile
46
51
  - Rakefile
52
+ - bin/points-anamileage
53
+ - bin/points-rakuten
47
54
  - bin/points-tpoint
48
55
  - lib/points-scraper.rb
49
56
  - lib/points-scraper/version.rb
@@ -67,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
74
  - !ruby/object:Gem::Version
68
75
  version: '0'
69
76
  requirements: []
70
- rubyforge_project: points-scraper
77
+ rubyforge_project:
71
78
  rubygems_version: 1.8.11
72
79
  signing_key:
73
80
  specification_version: 3