google_play_reviews 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/bin/google_play_reviews +7 -4
- data/lib/google_play_reviews.rb +1 -0
- data/lib/google_play_reviews/fetcher.rb +6 -2
- data/lib/google_play_reviews/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfb7eaf2b850e64a45299cd7e192e6ec4c373e7d
|
4
|
+
data.tar.gz: f11799328a9206e8a3e38ef9ba873c09dcb7d12e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8b5867a2c59a6c4519ec79c0401a1e6b1cb42c6496285cb350b1efa36b9555ef951e59db08f6dc0fc65f548b1060ccf03d4477ab54a62e1484ae05d558bf399
|
7
|
+
data.tar.gz: 7b0f51282771b4e137ecffb0962a3dd990e8fbf93bfb24c2c8abdba3b4b4a1e606723f303f78a6c8cbefb3cb3369aba8075a481f0a49639abf832ff5d173b5b4
|
data/.gitignore
CHANGED
data/bin/google_play_reviews
CHANGED
@@ -9,6 +9,10 @@ options = {}
|
|
9
9
|
opts = OptionParser.new do |opts|
|
10
10
|
opts.banner = "Usage: google_play_reviews [options] APP_ID"
|
11
11
|
|
12
|
+
opts.on("-l [VALUE]", "--host-language [VALUE]", "Host language: use 'en' as default") do |host_language|
|
13
|
+
options[:host_language] = host_language
|
14
|
+
end
|
15
|
+
|
12
16
|
opts.on("-s [VALUE]", "--sort-order [VALUE]", "Sort order: 'newest'(default), 'rating' or 'helpfulness'") do |sort_order|
|
13
17
|
puts "Invalid sort-order." unless GooglePlayReviews.invalid_sort_order?(sort_order.to_sym)
|
14
18
|
options[:sort_order] = GooglePlayReviews::SortOrder[sort_order.to_sym]
|
@@ -19,17 +23,16 @@ opts = OptionParser.new do |opts|
|
|
19
23
|
end
|
20
24
|
|
21
25
|
opts.on("-v", "--version", "Display the current version") do
|
22
|
-
puts "
|
26
|
+
puts "google_play_reviews " + GooglePlayReviews::VERSION
|
23
27
|
exit 0
|
24
28
|
end
|
25
|
-
|
26
29
|
end
|
27
30
|
opts.parse!
|
28
31
|
|
29
|
-
(ARGV[0] = '
|
32
|
+
(ARGV[0] = '--help'; opts.parse!) unless ARGV[0]
|
30
33
|
|
31
34
|
entries = GooglePlayReviews.fetch(ARGV[0], options)
|
32
|
-
if entries.any?
|
35
|
+
if entries && entries.any?
|
33
36
|
puts "------------------------------"
|
34
37
|
entries.each do |entry|
|
35
38
|
puts entry
|
data/lib/google_play_reviews.rb
CHANGED
@@ -19,6 +19,7 @@ module GooglePlayReviews
|
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
22
|
+
|
22
23
|
def fetch_html_from_google_play
|
23
24
|
uri = URI.parse(GET_REVIEWS_URL)
|
24
25
|
http = Net::HTTP.new(uri.host, uri.port)
|
@@ -29,7 +30,9 @@ module GooglePlayReviews
|
|
29
30
|
id: app_id,
|
30
31
|
reviewSortOrder: @options[:sort_order],
|
31
32
|
reviewType: 1,
|
32
|
-
pageNum: @options[:page]
|
33
|
+
pageNum: @options[:page],
|
34
|
+
xhr: 1,
|
35
|
+
hl: @options[:host_language],
|
33
36
|
})
|
34
37
|
response = http.start do |h|
|
35
38
|
h.request(request)
|
@@ -50,7 +53,8 @@ module GooglePlayReviews
|
|
50
53
|
entry.author_url = GOOGLE_PLAY_ROOT_URL + node.css(".author-name a").first["href"]
|
51
54
|
entry.author_image_url = node.css(".author-image").first["src"]
|
52
55
|
end
|
53
|
-
|
56
|
+
node.css(".review-body").first.css("a").remove
|
57
|
+
entry.review_body = node.css(".review-body").first.text.strip
|
54
58
|
entry.rating = node.css(".current-rating").first["style"].gsub(/[^0-9]/, '').to_i / 20
|
55
59
|
entry.review_date_string = node.css(".review-date").first.text
|
56
60
|
entry.review_url = GOOGLE_PLAY_ROOT_URL + node.css("a.reviews-permalink").first["href"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_play_reviews
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Weihu Chen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -107,8 +107,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
109
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.4.
|
110
|
+
rubygems_version: 2.4.8
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: Fetch App reviews from Google Play.
|
114
114
|
test_files: []
|
115
|
+
has_rdoc:
|