google_play_search 0.0.6 → 0.0.7
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/lib/google_play_search/app_parser.rb +14 -16
- data/lib/google_play_search/search.rb +5 -6
- metadata +16 -11
- checksums.yaml +0 -7
@@ -9,8 +9,8 @@ module GooglePlaySearch
|
|
9
9
|
end
|
10
10
|
def parse
|
11
11
|
app_search_result_list = []
|
12
|
-
if @doc.css("
|
13
|
-
@doc.css("
|
12
|
+
if @doc.css("div.card-list div.card").size > 0
|
13
|
+
@doc.css("div.card-list div.card").each do |app_content|
|
14
14
|
app_search_result_list << create_app(app_content)
|
15
15
|
end
|
16
16
|
else
|
@@ -23,7 +23,7 @@ module GooglePlaySearch
|
|
23
23
|
|
24
24
|
private
|
25
25
|
def get_url(app_content)
|
26
|
-
url = $GOOGLE_PLAY_STORE_BASE_URL + app_content.css("div.
|
26
|
+
url = $GOOGLE_PLAY_STORE_BASE_URL + app_content.css("div.cover a.card-content-link").first['href']
|
27
27
|
if url.end_with?(SEARCH_APP_URL_END_SUFF)
|
28
28
|
url = url[0..-1* (SEARCH_APP_URL_END_SUFF.size + 1)]
|
29
29
|
end
|
@@ -31,15 +31,15 @@ module GooglePlaySearch
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def get_logo_url(app_content)
|
34
|
-
app_content.css("div.
|
34
|
+
app_content.css("div.cover div.cover-inner-align img").first['src']
|
35
35
|
end
|
36
36
|
|
37
37
|
def get_name(app_content)
|
38
|
-
app_content.css("div.details a.title").first.content
|
38
|
+
app_content.css("div.details a.title").first.content.strip
|
39
39
|
end
|
40
40
|
|
41
41
|
def get_developer(app_content)
|
42
|
-
deleloper_contents_list = app_content.css("div.details div.
|
42
|
+
deleloper_contents_list = app_content.css("div.details div.subtitle-container a.subtitle")
|
43
43
|
if deleloper_contents_list && deleloper_contents_list.size > 0
|
44
44
|
return deleloper_contents_list.first.content
|
45
45
|
else
|
@@ -62,17 +62,17 @@ module GooglePlaySearch
|
|
62
62
|
def get_short_description(app_content)
|
63
63
|
description_contents = app_content.css("div.description")
|
64
64
|
if description_contents && description_contents.size > 0
|
65
|
-
return description_contents.first.content
|
65
|
+
return description_contents.first.content.strip
|
66
66
|
end
|
67
67
|
return ""
|
68
68
|
end
|
69
69
|
|
70
70
|
def get_app_rating(app_content)
|
71
|
-
ratings = app_content.css("div.
|
72
|
-
if ratings
|
73
|
-
rating_str = ratings.first['
|
71
|
+
ratings = app_content.css("div.current-rating")
|
72
|
+
if ratings
|
73
|
+
rating_str = ratings.first['style']
|
74
74
|
unless rating_str.empty?
|
75
|
-
return rating_str[/\d+\.?\d?/].to_f
|
75
|
+
return rating_str[/\d+\.?\d?/].to_f / 100 * 5
|
76
76
|
end
|
77
77
|
return 0
|
78
78
|
end
|
@@ -86,9 +86,9 @@ module GooglePlaySearch
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def get_app_price(app_content)
|
89
|
-
prices = app_content.css("span.
|
90
|
-
if prices
|
91
|
-
if match = prices.first.content.match(/(.[0-9]*\.[0-9]+|[0-9]+)
|
89
|
+
prices = app_content.css("div.details span.price span")
|
90
|
+
if prices
|
91
|
+
if match = prices.first.content.match(/(.[0-9]*\.[0-9]+|[0-9]+)/)
|
92
92
|
return match[1]
|
93
93
|
end
|
94
94
|
end
|
@@ -102,11 +102,9 @@ module GooglePlaySearch
|
|
102
102
|
app.name = get_name app_content
|
103
103
|
app.price = get_app_price app_content
|
104
104
|
app.developer = get_developer app_content
|
105
|
-
app.category = get_category app_content
|
106
105
|
app.logo_url = get_logo_url app_content
|
107
106
|
app.short_description = get_short_description app_content
|
108
107
|
app.rating = get_app_rating app_content
|
109
|
-
app.reviews = get_app_reviews app_content
|
110
108
|
return app
|
111
109
|
end
|
112
110
|
end
|
@@ -8,13 +8,13 @@ module GooglePlaySearch
|
|
8
8
|
class Search
|
9
9
|
attr_accessor :current_page, :keyword
|
10
10
|
|
11
|
-
$GOOGLE_PLAY_STORE_BASE_URL = "https://play.google.com"
|
11
|
+
$GOOGLE_PLAY_STORE_BASE_URL = "https://play.google.com"
|
12
12
|
|
13
|
-
GOOGLE_PLAY_BASE_SEARCH_URL = $GOOGLE_PLAY_STORE_BASE_URL + "/store/search?q="
|
13
|
+
GOOGLE_PLAY_BASE_SEARCH_URL = $GOOGLE_PLAY_STORE_BASE_URL + "/store/search?q="
|
14
14
|
|
15
|
-
DEFAULT_SEARCH_CONDITION = {:language => "en",
|
16
|
-
:category => "apps",
|
17
|
-
:per_page_num => 24,
|
15
|
+
DEFAULT_SEARCH_CONDITION = {:language => "en",
|
16
|
+
:category => "apps",
|
17
|
+
:per_page_num => 24,
|
18
18
|
:price => "0",
|
19
19
|
:safe_search => "0",
|
20
20
|
:sort_by => "1"}
|
@@ -52,4 +52,3 @@ module GooglePlaySearch
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
|
metadata
CHANGED
@@ -1,27 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_play_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Grant Chen
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2012-
|
12
|
+
date: 2012-07-16 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: nokogiri
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- - '>='
|
19
|
+
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: 1.5.3
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
|
-
- - '>='
|
27
|
+
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: 1.5.3
|
27
30
|
description: google play market search gem
|
@@ -31,30 +34,32 @@ extensions: []
|
|
31
34
|
extra_rdoc_files: []
|
32
35
|
files:
|
33
36
|
- lib/google_play_search.rb
|
34
|
-
- lib/google_play_search/search.rb
|
35
|
-
- lib/google_play_search/app_parser.rb
|
36
37
|
- lib/google_play_search/app.rb
|
38
|
+
- lib/google_play_search/app_parser.rb
|
39
|
+
- lib/google_play_search/search.rb
|
37
40
|
homepage: https://github.com/grantchen/google_play_search
|
38
41
|
licenses: []
|
39
|
-
metadata: {}
|
40
42
|
post_install_message:
|
41
43
|
rdoc_options: []
|
42
44
|
require_paths:
|
43
45
|
- lib
|
44
46
|
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
45
48
|
requirements:
|
46
|
-
- - '>='
|
49
|
+
- - ! '>='
|
47
50
|
- !ruby/object:Gem::Version
|
48
51
|
version: '0'
|
49
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
50
54
|
requirements:
|
51
|
-
- - '>='
|
55
|
+
- - ! '>='
|
52
56
|
- !ruby/object:Gem::Version
|
53
57
|
version: '0'
|
54
58
|
requirements: []
|
55
59
|
rubyforge_project:
|
56
|
-
rubygems_version:
|
60
|
+
rubygems_version: 1.8.25
|
57
61
|
signing_key:
|
58
|
-
specification_version:
|
62
|
+
specification_version: 3
|
59
63
|
summary: google play market search
|
60
64
|
test_files: []
|
65
|
+
has_rdoc:
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: b4166b35ed26f6d6658a42b8de2e8b152788143f
|
4
|
-
data.tar.gz: ab3e879355c59c5c9247cea891af6899a0babb44
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 2c64bf7eaa2d536f714293213015e50a150f26204b79c46e1ded793eb6c00af6088b5b10f3ad2127e256575169972140d0970852cd1ae625a5384fffc9efcb48
|
7
|
-
data.tar.gz: 225884c444c6c50b64c33ec81bab2bfd1405527d441c1387c8a23eae565e3cb2e241f9d1ce8a8900152ce447a908b0f30dfee1389f88cbdd185d94f88d1f4f3c
|