google_play_search 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/google_play_search/search.rb +19 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b6c6d9904e4e95f237945ab0945975624d80a2c
|
4
|
+
data.tar.gz: 310d5be7e53b3e4fbd7ba779f41bcb80e3c54274
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afdcba6273839fd59aed5574c475223236d613f1f2427c54008676caf8778bdb8c7f669c31ebdc6df3718cb343365bcc625bd514ef85408f3ef4f134ca746e90
|
7
|
+
data.tar.gz: 4955076d469b0da3cbd39ed613914e13586a88ad06aad72d27d7dad91cba66591d0cd1eecb4b04601125fb74b4644e1e21f01f873656f6d6683a59507e32fdd3
|
@@ -14,26 +14,27 @@ module GooglePlaySearch
|
|
14
14
|
|
15
15
|
DEFAULT_SEARCH_CONDITION = {:language => "en",
|
16
16
|
:category => "apps",
|
17
|
-
|
17
|
+
#:per_page_num => 20,
|
18
18
|
:price => "0",
|
19
|
-
|
20
|
-
:
|
19
|
+
#:safe_search => "0",
|
20
|
+
:rating => "0"}
|
21
21
|
|
22
22
|
def initialize(search_condition = DEFAULT_SEARCH_CONDITION)
|
23
23
|
@search_condition = DEFAULT_SEARCH_CONDITION.merge(search_condition)
|
24
|
+
@next_page_token = nil
|
24
25
|
@current_page = 1
|
25
26
|
end
|
26
27
|
|
27
28
|
def search(keyword, options={})
|
28
|
-
@current_page = options[:page].nil? ? 1 : options[:page]
|
29
29
|
@keyword = keyword
|
30
30
|
stdout = open(init_query_url).read()
|
31
|
+
get_next_page_token(stdout)
|
31
32
|
AppParser.new(stdout).parse
|
32
33
|
end
|
33
34
|
|
34
35
|
def next_page()
|
35
|
-
@current_page
|
36
|
-
search @keyword
|
36
|
+
@current_page += 1
|
37
|
+
search @keyword
|
37
38
|
end
|
38
39
|
|
39
40
|
private
|
@@ -44,10 +45,18 @@ module GooglePlaySearch
|
|
44
45
|
query_url << "c=" << @search_condition[:category] << "&"
|
45
46
|
query_url << "hl=" << @search_condition[:language] << "&"
|
46
47
|
query_url << "price=" << @search_condition[:price] << "&"
|
47
|
-
query_url << "
|
48
|
-
query_url << "
|
49
|
-
|
50
|
-
query_url << "start
|
48
|
+
query_url << "rating=" << @search_condition[:rating] << "&"
|
49
|
+
#query_url << "safe=" << @search_condition[:safe_search] << "&"
|
50
|
+
#query_url << "sort=" << @search_condition[:sort_by] << "&"
|
51
|
+
query_url << "start=0&num=0"
|
52
|
+
if @next_page_token
|
53
|
+
query_url << "&pagTok=#{@next_page_token}"
|
54
|
+
end
|
55
|
+
query_url
|
56
|
+
end
|
57
|
+
|
58
|
+
def get_next_page_token(response_body)
|
59
|
+
@next_page_token = response_body.match(/(GAEi+.+:S:.{11})\\42/)[1][-22..-1]
|
51
60
|
end
|
52
61
|
end
|
53
62
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grant Chen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|