market_bot 0.1.6 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/market_bot/android/app.rb +25 -0
- data/market_bot.gemspec +2 -2
- data/spec/market_bot/android/app_spec.rb +14 -1
- metadata +21 -21
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -50,6 +50,31 @@ module MarketBot
|
|
50
50
|
votes_elem = doc.css('.votes')
|
51
51
|
result[:votes] = doc.css('.votes').first.text unless votes_elem.empty?
|
52
52
|
|
53
|
+
similar_elem = doc.css('.doc-similar').first
|
54
|
+
|
55
|
+
if similar_elem
|
56
|
+
similar_elem.children.each do |similar_elem_child|
|
57
|
+
assoc_app_type = similar_elem_child.attributes['data-analyticsid'].text
|
58
|
+
|
59
|
+
case assoc_app_type
|
60
|
+
when 'more-from-developer'
|
61
|
+
when 'users-also-installed'
|
62
|
+
when 'related'
|
63
|
+
else
|
64
|
+
next
|
65
|
+
end
|
66
|
+
|
67
|
+
assoc_app_type = assoc_app_type.gsub('-', '_').to_sym
|
68
|
+
result[assoc_app_type] ||= []
|
69
|
+
|
70
|
+
similar_elem_child.css('.app-left-column-related-snippet-container').each do |app_elem|
|
71
|
+
assoc_app = {}
|
72
|
+
assoc_app[:app_id] = app_elem.attributes['data-docid'].text
|
73
|
+
result[assoc_app_type] << assoc_app
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
53
78
|
result
|
54
79
|
end
|
55
80
|
|
data/market_bot.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "market_bot"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Chad Remesch"]
|
12
|
-
s.date = "2011-10-
|
12
|
+
s.date = "2011-10-27"
|
13
13
|
s.description = "Market Bot is a high performance Ruby scraper for Google's Android Market with a simple to use API. It is built on top of Nokogiri and Typhoeus."
|
14
14
|
s.email = "chad@remesch.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -76,13 +76,13 @@ describe 'App' do
|
|
76
76
|
result[:content_rating].should == 'Low Maturity'
|
77
77
|
result[:description].should =~ /^Evernote turns your Android device into an extension/
|
78
78
|
result[:votes].should == '173,307'
|
79
|
+
result[:installs].should == nil
|
79
80
|
end
|
80
81
|
|
81
82
|
it 'should populate a hash with the correct keys/values even when rating and votes are missing' do
|
82
83
|
result = App.parse(test_src_data3)
|
83
84
|
|
84
85
|
result[:title].should == 'Thermometer HD'
|
85
|
-
result[:rating].should == nil
|
86
86
|
result[:updated].should == 'July 2, 2011'
|
87
87
|
result[:current_version].should == '1.5.1'
|
88
88
|
result[:requires_android].should == '2.0 and up'
|
@@ -91,8 +91,21 @@ describe 'App' do
|
|
91
91
|
result[:price].should == '$0.99'
|
92
92
|
result[:content_rating].should == 'Low Maturity'
|
93
93
|
result[:description].should =~ /^Want to know the up-to-date temperature and other weather/
|
94
|
+
result[:rating].should == nil
|
94
95
|
result[:votes].should == nil
|
95
96
|
end
|
97
|
+
|
98
|
+
it 'should populate the associated apps keys' do
|
99
|
+
result = App.parse(test_src_data2)
|
100
|
+
|
101
|
+
result[:related].should be_a(Array)
|
102
|
+
result[:users_also_installed].should be_a(Array)
|
103
|
+
result[:more_from_developer].should be_a(Array)
|
104
|
+
|
105
|
+
result[:related].first[:app_id].should == 'com.intsig.camscanner'
|
106
|
+
result[:users_also_installed].first[:app_id].should == 'com.divnil.paintforevernote'
|
107
|
+
result[:more_from_developer].first[:app_id].should == 'com.evernote.skitch'
|
108
|
+
end
|
96
109
|
end
|
97
110
|
|
98
111
|
context 'Updating' do
|
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
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-10-
|
12
|
+
date: 2011-10-27 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: typhoeus
|
16
|
-
requirement: &
|
16
|
+
requirement: &70317712625840 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.2.4
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70317712625840
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: nokogiri
|
27
|
-
requirement: &
|
27
|
+
requirement: &70317712619580 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.5.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70317712619580
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70317712618980 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.3.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70317712618980
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &70317712618380 !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: *70317712618380
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: jeweler
|
60
|
-
requirement: &
|
60
|
+
requirement: &70317712617780 !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: *70317712617780
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rcov
|
71
|
-
requirement: &
|
71
|
+
requirement: &70317712617180 !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: *70317712617180
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: ZenTest
|
82
|
-
requirement: &
|
82
|
+
requirement: &70317712616580 !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: *70317712616580
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: ruby-debug19
|
93
|
-
requirement: &
|
93
|
+
requirement: &70317712615980 !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: *70317712615980
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: rdoc
|
104
|
-
requirement: &
|
104
|
+
requirement: &70317712615380 !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: *70317712615380
|
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: 2989164660986462426
|
164
164
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
165
|
none: false
|
166
166
|
requirements:
|