google_play_search 0.0.10 → 0.0.11
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.
- checksums.yaml +4 -4
- data/lib/google_play_search/app.rb +44 -1
- data/lib/google_play_search/app_parser.rb +2 -2
- data/lib/google_play_search/search.rb +3 -4
- metadata +11 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3cf1f8105859eca32f01af1eee511eb259186832
|
|
4
|
+
data.tar.gz: 6547d346b7b2d3da428402e861656aaec59b1569
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3cf9237114d517baac5c24516f8b9c3ae7c50236b6c51edbe79ddfcaeeb6da74367c363bb28450b8593a697ba4cc20dd978ab1890ce93a4bc3ec8dc4c6afccc9
|
|
7
|
+
data.tar.gz: fce11a26d5f9915d79e3f7d2de1c3665c2bbe8641f399b7da4cc1d735a8729a57a91a5586db79f71dae7900a69c342a4f89ded8bf6831849403242366a694e9a
|
|
@@ -1,5 +1,48 @@
|
|
|
1
|
+
require 'open-uri'
|
|
1
2
|
module GooglePlaySearch
|
|
2
3
|
class App
|
|
3
|
-
attr_accessor :id, :name, :url, :developer, :category, :logo_url,
|
|
4
|
+
attr_accessor :id, :name, :url, :developer, :category, :logo_url,
|
|
5
|
+
:short_description, :rating, :reviews, :price,
|
|
6
|
+
:version, :installs, :last_updated, :size,
|
|
7
|
+
:requires_android, :content_rating
|
|
8
|
+
|
|
9
|
+
def get_all_details()
|
|
10
|
+
html = open(self.url).read()
|
|
11
|
+
google_play_html = Nokogiri::HTML(html)
|
|
12
|
+
|
|
13
|
+
self.version = get_version(google_play_html)
|
|
14
|
+
self.last_updated = get_last_updated(google_play_html)
|
|
15
|
+
self.installs = get_installs(google_play_html)
|
|
16
|
+
self.size = get_size(google_play_html)
|
|
17
|
+
self.requires_android = get_requires_android(google_play_html)
|
|
18
|
+
self.content_rating = get_content_rating(google_play_html)
|
|
19
|
+
self
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
def get_version(google_play_html)
|
|
24
|
+
google_play_html.search("div[itemprop='softwareVersion']").first.content.strip
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def get_last_updated(google_play_html)
|
|
28
|
+
google_play_html.search("div[itemprop='datePublished']").first.content.strip
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def get_installs(google_play_html)
|
|
32
|
+
google_play_html.search("div[itemprop='numDownloads']").first.content.strip
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def get_size(google_play_html)
|
|
36
|
+
google_play_html.search("div[itemprop='fileSize']").first.content.strip
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def get_requires_android(google_play_html)
|
|
40
|
+
google_play_html.search("div[itemprop='operatingSystems']").first.content.strip
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def get_content_rating(google_play_html)
|
|
44
|
+
google_play_html.search("div[itemprop='contentRating']").first.content.strip
|
|
45
|
+
end
|
|
46
|
+
|
|
4
47
|
end
|
|
5
48
|
end
|
|
@@ -69,7 +69,7 @@ module GooglePlaySearch
|
|
|
69
69
|
|
|
70
70
|
def get_app_rating(app_content)
|
|
71
71
|
ratings = app_content.css("div.current-rating")
|
|
72
|
-
if ratings
|
|
72
|
+
if ratings && ratings.first
|
|
73
73
|
rating_str = ratings.first['style']
|
|
74
74
|
unless rating_str.empty?
|
|
75
75
|
return rating_str[/\d+\.?\d?/].to_f / 100 * 5
|
|
@@ -87,7 +87,7 @@ module GooglePlaySearch
|
|
|
87
87
|
|
|
88
88
|
def get_app_price(app_content)
|
|
89
89
|
prices = app_content.css("div.details span.price-container button.price span")
|
|
90
|
-
if prices
|
|
90
|
+
if prices and prices.first
|
|
91
91
|
if match = prices.first.content.match(/(.[0-9]*\.[0-9]+|[0-9]+)/)
|
|
92
92
|
return match[1]
|
|
93
93
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'rubygems'
|
|
2
2
|
require 'nokogiri'
|
|
3
|
-
require '
|
|
3
|
+
require 'open-uri'
|
|
4
4
|
require 'cgi'
|
|
5
5
|
require File.expand_path(File.dirname(__FILE__) + '/app_parser')
|
|
6
6
|
|
|
@@ -27,8 +27,8 @@ module GooglePlaySearch
|
|
|
27
27
|
def search(keyword, options={})
|
|
28
28
|
@current_page = options[:page].nil? ? 1 : options[:page]
|
|
29
29
|
@keyword = keyword
|
|
30
|
-
|
|
31
|
-
AppParser.new(stdout
|
|
30
|
+
stdout = open(init_query_url).read()
|
|
31
|
+
AppParser.new(stdout).parse
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def next_page()
|
|
@@ -51,4 +51,3 @@ module GooglePlaySearch
|
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
|
-
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Grant Chen
|
|
@@ -14,28 +14,29 @@ dependencies:
|
|
|
14
14
|
name: nokogiri
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- -
|
|
17
|
+
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 1.5
|
|
19
|
+
version: '1.5'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- -
|
|
24
|
+
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 1.5
|
|
26
|
+
version: '1.5'
|
|
27
27
|
description: google play market search gem
|
|
28
28
|
email: kucss@hotmail.com
|
|
29
29
|
executables: []
|
|
30
30
|
extensions: []
|
|
31
31
|
extra_rdoc_files: []
|
|
32
32
|
files:
|
|
33
|
+
- lib/google_play_search.rb
|
|
33
34
|
- lib/google_play_search/app.rb
|
|
34
35
|
- lib/google_play_search/app_parser.rb
|
|
35
36
|
- lib/google_play_search/search.rb
|
|
36
|
-
- lib/google_play_search.rb
|
|
37
37
|
homepage: https://github.com/grantchen/google_play_search
|
|
38
|
-
licenses:
|
|
38
|
+
licenses:
|
|
39
|
+
- MIT
|
|
39
40
|
metadata: {}
|
|
40
41
|
post_install_message:
|
|
41
42
|
rdoc_options: []
|
|
@@ -43,17 +44,17 @@ require_paths:
|
|
|
43
44
|
- lib
|
|
44
45
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
45
46
|
requirements:
|
|
46
|
-
- -
|
|
47
|
+
- - ">="
|
|
47
48
|
- !ruby/object:Gem::Version
|
|
48
49
|
version: '0'
|
|
49
50
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
50
51
|
requirements:
|
|
51
|
-
- -
|
|
52
|
+
- - ">="
|
|
52
53
|
- !ruby/object:Gem::Version
|
|
53
54
|
version: '0'
|
|
54
55
|
requirements: []
|
|
55
56
|
rubyforge_project:
|
|
56
|
-
rubygems_version: 2.
|
|
57
|
+
rubygems_version: 2.4.5
|
|
57
58
|
signing_key:
|
|
58
59
|
specification_version: 4
|
|
59
60
|
summary: google play market search
|