google_play_search 0.0.14 → 0.0.15
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/app.rb +32 -11
- 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: 020076ceb9a218e038f781743aef22442e764ac4
|
4
|
+
data.tar.gz: baf36ed4f544cc1ef3e7cb2e271ce01b43a1e34d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f354c93eb871c23102072803a88f9f25aec420cfe3c000b41c262170fabaa610ce8a83b381b880a53ffa6c81b38797045c8d7d403854ff8bd6fec44efb7b9d7
|
7
|
+
data.tar.gz: 47ffd76b43bc9aa0d40e35ab280a1787e78627266a00d686e269d1e37b0ab7294c36dbf2046318f07d1c82b7fed2002953cec518bdd9145aea5da6bc2e41af33
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'open-uri'
|
2
|
+
require 'nokogiri'
|
2
3
|
require File.expand_path(File.dirname(__FILE__) + '/review')
|
3
4
|
|
4
5
|
module GooglePlaySearch
|
@@ -7,7 +8,7 @@ module GooglePlaySearch
|
|
7
8
|
:short_description, :rating, :reviews, :price,
|
8
9
|
:version, :installs, :last_updated, :size,
|
9
10
|
:requires_android, :content_rating, :developer_website,
|
10
|
-
:developer_email, :developer_address
|
11
|
+
:developer_email, :developer_address, :screenshots
|
11
12
|
|
12
13
|
def get_all_details()
|
13
14
|
html = open(self.url).read()
|
@@ -24,6 +25,7 @@ module GooglePlaySearch
|
|
24
25
|
self.developer_email = get_developer_email(google_play_html)
|
25
26
|
self.developer_address = get_developer_address(google_play_html)
|
26
27
|
self.reviews = get_reviews(google_play_html)
|
28
|
+
self.screenshots = get_screenshots(google_play_html)
|
27
29
|
self
|
28
30
|
rescue
|
29
31
|
self
|
@@ -32,44 +34,54 @@ module GooglePlaySearch
|
|
32
34
|
private
|
33
35
|
|
34
36
|
def get_version(google_play_html)
|
35
|
-
google_play_html.search("div[itemprop='softwareVersion']").first
|
37
|
+
version = google_play_html.search("div[itemprop='softwareVersion']").first
|
38
|
+
version.content.strip if version
|
36
39
|
end
|
37
40
|
|
38
41
|
def get_last_updated(google_play_html)
|
39
|
-
google_play_html.search("div[itemprop='datePublished']").first
|
42
|
+
last_updated = google_play_html.search("div[itemprop='datePublished']").first
|
43
|
+
last_updated.content.strip if last_updated
|
40
44
|
end
|
41
45
|
|
42
46
|
def get_installs(google_play_html)
|
43
|
-
google_play_html.search("div[itemprop='numDownloads']").first
|
47
|
+
installs = google_play_html.search("div[itemprop='numDownloads']").first
|
48
|
+
installs.content.strip if installs
|
44
49
|
end
|
45
50
|
|
46
51
|
def get_size(google_play_html)
|
47
|
-
google_play_html.search("div[itemprop='fileSize']").first
|
52
|
+
size = google_play_html.search("div[itemprop='fileSize']").first
|
53
|
+
size.content.strip if size
|
48
54
|
end
|
49
55
|
|
50
56
|
def get_requires_android(google_play_html)
|
51
|
-
google_play_html.search("div[itemprop='operatingSystems']").first
|
57
|
+
requires_android = google_play_html.search("div[itemprop='operatingSystems']").first
|
58
|
+
requires_android.content.strip if requires_android
|
52
59
|
end
|
53
60
|
|
54
61
|
def get_content_rating(google_play_html)
|
55
|
-
google_play_html.search("div[itemprop='contentRating']").first
|
62
|
+
content_rating = google_play_html.search("div[itemprop='contentRating']").first
|
63
|
+
content_rating.content.strip if content_rating
|
56
64
|
end
|
57
65
|
|
58
66
|
def get_category(google_play_html)
|
59
|
-
google_play_html.search("span[itemprop='genre']").first
|
67
|
+
category = google_play_html.search("span[itemprop='genre']").first
|
68
|
+
category.content.strip if category
|
60
69
|
end
|
61
70
|
|
62
71
|
def get_developer_website(google_play_html)
|
63
72
|
url = google_play_html.search("a[class='dev-link']").first['href'].strip.gsub("https://www.google.com/url?q=", "")
|
64
|
-
url[0..(url.index("&") - 1)]
|
73
|
+
url[0..(url.index("&") - 1)] if url.index("&")
|
65
74
|
end
|
66
75
|
|
67
76
|
def get_developer_email(google_play_html)
|
68
|
-
google_play_html.search("a[class='dev-link']").
|
77
|
+
google_play_html.search("a[class='dev-link']").each do |ele|
|
78
|
+
return ele.content.strip.gsub("Email ", "") if ele.content.strip.index("Email")
|
79
|
+
end
|
69
80
|
end
|
70
81
|
|
71
82
|
def get_developer_address(google_play_html)
|
72
|
-
google_play_html.search("div[class='content physical-address']").first
|
83
|
+
address = google_play_html.search("div[class='content physical-address']").first
|
84
|
+
address.content.strip if address
|
73
85
|
end
|
74
86
|
|
75
87
|
def get_reviews(google_play_html)
|
@@ -85,5 +97,14 @@ module GooglePlaySearch
|
|
85
97
|
end
|
86
98
|
reviews
|
87
99
|
end
|
100
|
+
|
101
|
+
def get_screenshots(google_play_html)
|
102
|
+
screenshots = []
|
103
|
+
google_play_html.search("div[class='screenshot-align-inner'] img").each do |ele|
|
104
|
+
screenshots << ele['src'].strip
|
105
|
+
end
|
106
|
+
screenshots
|
107
|
+
end
|
108
|
+
|
88
109
|
end
|
89
110
|
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.15
|
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-07-
|
11
|
+
date: 2015-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|