market_bot 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +3 -1
- data/VERSION +1 -1
- data/lib/market_bot/android/leaderboard.rb +7 -6
- data/lib/market_bot/android/leaderboard/constants.rb +10 -10
- data/market_bot.gemspec +1 -1
- data/spec/market_bot/android/leaderboard_spec.rb +8 -8
- metadata +20 -20
data/README.markdown
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Market Bot - High performance Ruby scraper for Google's Android Market
|
2
2
|
|
3
|
-
Market Bot is a high performance Ruby scraper for Google's Android Market with a simple to use API.
|
3
|
+
Market Bot is a high performance Ruby scraper for Google's Android Market with a simple to use API.
|
4
|
+
It is built on top of Nokogiri and Typhoeus.
|
5
|
+
Used in production to power [www.droidmeter.com](http://www.droidmeter.com).
|
4
6
|
|
5
7
|
## Dependencies
|
6
8
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.2
|
@@ -55,7 +55,7 @@ module MarketBot
|
|
55
55
|
result[:price_usd] = nil
|
56
56
|
result[:developer] = snippet_node.css('.attribution').text
|
57
57
|
result[:market_id] = snippet_node.attributes['data-docid'].text
|
58
|
-
result[:market_url] = "https://
|
58
|
+
result[:market_url] = "https://play.google.com/store/apps/details?id=#{result[:market_id]}"
|
59
59
|
|
60
60
|
results << result
|
61
61
|
end
|
@@ -79,9 +79,10 @@ module MarketBot
|
|
79
79
|
(min_page..max_page).each do |page|
|
80
80
|
start_val = (page - 1) * 24
|
81
81
|
|
82
|
-
url = 'https://
|
83
|
-
url << "
|
84
|
-
url << "
|
82
|
+
url = 'https://play.google.com/store/apps'
|
83
|
+
url << "/category/#{category.to_s.upcase}" if category
|
84
|
+
url << "/collection/#{identifier.to_s}?"
|
85
|
+
url << "start=#{start_val}"
|
85
86
|
url << "&num=24"
|
86
87
|
|
87
88
|
results << url
|
@@ -91,8 +92,8 @@ module MarketBot
|
|
91
92
|
end
|
92
93
|
|
93
94
|
def enqueue_update(options={})
|
94
|
-
if @identifier.to_s.downcase == '
|
95
|
-
url = 'https://
|
95
|
+
if @identifier.to_s.downcase == 'editors_choice' && category == nil
|
96
|
+
url = 'https://play.google.com/store/apps/collection/editors_choice'
|
96
97
|
process_page(url, 1)
|
97
98
|
else
|
98
99
|
min_rank = options[:min_rank] || 1
|
@@ -3,16 +3,16 @@ module MarketBot
|
|
3
3
|
|
4
4
|
class Leaderboard
|
5
5
|
IDENTIFIERS = [
|
6
|
-
:
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
6
|
+
:editors_choice,
|
7
|
+
:featured,
|
8
|
+
:movers_shakers,
|
9
|
+
:tablet_featured,
|
10
|
+
:topgrossing,
|
11
|
+
:topselling_free,
|
12
|
+
:topselling_new_free,
|
13
|
+
:topselling_new_paid,
|
14
|
+
:topselling_paid,
|
15
|
+
:topselling_paid_game
|
16
16
|
]
|
17
17
|
|
18
18
|
CATEGORIES = [
|
data/market_bot.gemspec
CHANGED
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
|
2
2
|
|
3
3
|
include MarketBot::Android
|
4
4
|
|
5
|
-
test_id = :
|
5
|
+
test_id = :topselling_paid
|
6
6
|
test_category = :arcade
|
7
7
|
|
8
8
|
|
@@ -15,14 +15,14 @@ def stub_hydra(hydra)
|
|
15
15
|
(0...4).each do |i|
|
16
16
|
start = i * 24
|
17
17
|
response = Typhoeus::Response.new(:code => 200, :headers => '', :body => test_src_pages[i + 1])
|
18
|
-
url = "https://
|
18
|
+
url = "https://play.google.com/store/apps/category/ARCADE/collection/topselling_paid?start=#{start}&num=24"
|
19
19
|
hydra.stub(:get, url).and_return(response)
|
20
20
|
end
|
21
21
|
|
22
22
|
test_src_editors_choice = read_file(File.dirname(__FILE__), 'data', "leaderboard-apps_editors_choice.txt")
|
23
23
|
|
24
24
|
response = Typhoeus::Response.new(:code => 200, :headers => '', :body => test_src_editors_choice)
|
25
|
-
url = "https://
|
25
|
+
url = "https://play.google.com/store/apps/collection/editors_choice"
|
26
26
|
hydra.stub(:get, url).and_return(response)
|
27
27
|
end
|
28
28
|
|
@@ -74,9 +74,9 @@ describe 'Leaderboard' do
|
|
74
74
|
lb = Leaderboard.new(test_id, test_category)
|
75
75
|
urls = lb.market_urls(:min_page => 1, :max_page => 3)
|
76
76
|
urls.should == [
|
77
|
-
'https://
|
78
|
-
'https://
|
79
|
-
'https://
|
77
|
+
'https://play.google.com/store/apps/category/ARCADE/collection/topselling_paid?start=0&num=24',
|
78
|
+
'https://play.google.com/store/apps/category/ARCADE/collection/topselling_paid?start=24&num=24',
|
79
|
+
'https://play.google.com/store/apps/category/ARCADE/collection/topselling_paid?start=48&num=24'
|
80
80
|
]
|
81
81
|
end
|
82
82
|
|
@@ -111,7 +111,7 @@ describe 'Leaderboard' do
|
|
111
111
|
it 'should properly parse the page and turn them into results' do
|
112
112
|
hydra = Typhoeus::Hydra.new
|
113
113
|
stub_hydra(hydra)
|
114
|
-
lb = Leaderboard.new('
|
114
|
+
lb = Leaderboard.new('editors_choice', nil, :hydra => hydra)
|
115
115
|
lb.update
|
116
116
|
|
117
117
|
lb.results.count.should == 37
|
@@ -122,7 +122,7 @@ describe 'Leaderboard' do
|
|
122
122
|
app[:price_usd].should == nil
|
123
123
|
app[:developer].should == 'WorldMate'
|
124
124
|
app[:market_id].should == 'com.worldmate'
|
125
|
-
app[:market_url].should == 'https://
|
125
|
+
app[:market_url].should == 'https://play.google.com/store/apps/details?id=com.worldmate'
|
126
126
|
end
|
127
127
|
end
|
128
128
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: market_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-03-07 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: typhoeus
|
16
|
-
requirement: &
|
16
|
+
requirement: &70137841300740 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70137841300740
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: nokogiri
|
27
|
-
requirement: &
|
27
|
+
requirement: &70137841299980 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70137841299980
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70137841298940 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.8.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70137841298940
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &70137841297980 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.0.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70137841297980
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: jeweler
|
60
|
-
requirement: &
|
60
|
+
requirement: &70137841297180 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.6.4
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70137841297180
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rcov
|
71
|
-
requirement: &
|
71
|
+
requirement: &70137841296340 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70137841296340
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: ZenTest
|
82
|
-
requirement: &
|
82
|
+
requirement: &70137841295440 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 4.6.2
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70137841295440
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: ruby-debug19
|
93
|
-
requirement: &
|
93
|
+
requirement: &70137841294640 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: 0.11.6
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70137841294640
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: rdoc
|
104
|
-
requirement: &
|
104
|
+
requirement: &70137841309420 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
version: 3.9.4
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70137841309420
|
113
113
|
description: Market Bot is a high performance Ruby scraper for Google's Android Market
|
114
114
|
with a simple to use API. It is built on top of Nokogiri and Typhoeus.
|
115
115
|
email: chad@remesch.com
|
@@ -160,7 +160,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
160
160
|
version: '0'
|
161
161
|
segments:
|
162
162
|
- 0
|
163
|
-
hash:
|
163
|
+
hash: 547635700124777251
|
164
164
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
165
|
none: false
|
166
166
|
requirements:
|