google-play 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-class.rb +41 -40
- metadata +3 -3
data/lib/google-play-class.rb
CHANGED
|
@@ -21,57 +21,58 @@ class PlayResult
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def fillPlayData(id,type,title)
|
|
24
|
-
doc = Nokogiri::HTML(open("https://play.google.com/store/#{type}/details?id=#{id}"))
|
|
25
|
-
get_price(
|
|
26
|
-
get_rating(
|
|
27
|
-
get_description(
|
|
28
|
-
get_thumbnail(
|
|
29
|
-
get_actors(
|
|
30
|
-
get_lengthtime(
|
|
31
|
-
get_contentrating(
|
|
32
|
-
get_genre(
|
|
33
|
-
get_related(
|
|
34
|
-
end
|
|
35
|
-
|
|
24
|
+
@@doc = Nokogiri::HTML(open("https://play.google.com/store/#{type}/details?id=#{id}"))
|
|
25
|
+
get_price()
|
|
26
|
+
get_rating()
|
|
27
|
+
get_description()
|
|
28
|
+
get_thumbnail()
|
|
29
|
+
get_actors()
|
|
30
|
+
get_lengthtime()
|
|
31
|
+
get_contentrating()
|
|
32
|
+
get_genre()
|
|
33
|
+
get_related()
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def get_title()
|
|
36
37
|
if @title == ""
|
|
37
|
-
@title = doc.css('div.doc-header-content h1.doc-header-title').text
|
|
38
|
+
@title = @@doc.css('div.doc-header-content h1.doc-header-title').text
|
|
38
39
|
end
|
|
39
40
|
end
|
|
40
|
-
def get_price(
|
|
41
|
-
if doc.css('.buy-wrapper .buy-border a.buy-link .buy-button-price').length != 0
|
|
42
|
-
@price = doc.css('.buy-wrapper .buy-border a.buy-link .buy-button-price')[0].text
|
|
41
|
+
def get_price()
|
|
42
|
+
if @@doc.css('.buy-wrapper .buy-border a.buy-link .buy-button-price').length != 0
|
|
43
|
+
@price = @@doc.css('.buy-wrapper .buy-border a.buy-link .buy-button-price')[0].text
|
|
43
44
|
end
|
|
44
45
|
end
|
|
45
46
|
|
|
46
|
-
def get_rating(
|
|
47
|
-
if doc.css('.doc-details-ratings-price div div.ratings').length != 0
|
|
48
|
-
@rating = doc.css('.doc-details-ratings-price div div.ratings')[0]['title']
|
|
47
|
+
def get_rating()
|
|
48
|
+
if @@doc.css('.doc-details-ratings-price div div.ratings').length != 0
|
|
49
|
+
@rating = @@doc.css('.doc-details-ratings-price div div.ratings')[0]['title']
|
|
49
50
|
end
|
|
50
51
|
end
|
|
51
52
|
|
|
52
|
-
def get_description(
|
|
53
|
-
if doc.css('div#doc-original-text').length != 0
|
|
54
|
-
@description = doc.css('div#doc-original-text').text
|
|
53
|
+
def get_description()
|
|
54
|
+
if @@doc.css('div#doc-original-text').length != 0
|
|
55
|
+
@description = @@doc.css('div#doc-original-text').text
|
|
55
56
|
end
|
|
56
57
|
end
|
|
57
58
|
|
|
58
|
-
def get_thumbnail(
|
|
59
|
-
if doc.css('div.doc-banner-icon img').length != 0
|
|
60
|
-
@thumbnail = doc.css('div.doc-banner-icon img')[0]['src']
|
|
59
|
+
def get_thumbnail()
|
|
60
|
+
if @@doc.css('div.doc-banner-icon img').length != 0
|
|
61
|
+
@thumbnail = @@doc.css('div.doc-banner-icon img')[0]['src']
|
|
61
62
|
end
|
|
62
63
|
end
|
|
63
64
|
|
|
64
|
-
def get_actors(
|
|
65
|
-
if doc.css('td.credit-cell span[itemprop=actors] a span').length != 0
|
|
66
|
-
doc.css('td.credit-cell span[itemprop=actors] a span').each{ |value|
|
|
65
|
+
def get_actors()
|
|
66
|
+
if @@doc.css('td.credit-cell span[itemprop=actors] a span').length != 0
|
|
67
|
+
@@doc.css('td.credit-cell span[itemprop=actors] a span').each{ |value|
|
|
67
68
|
@actors << value.text.to_s
|
|
68
69
|
}
|
|
69
70
|
end
|
|
70
71
|
end
|
|
71
72
|
|
|
72
|
-
def get_lengthtime(
|
|
73
|
-
if doc.css('dl.doc-metadata-list dd').length != 0
|
|
74
|
-
doc.css('dl.doc-metadata-list dd').each{ |value|
|
|
73
|
+
def get_lengthtime()
|
|
74
|
+
if @@doc.css('dl.doc-metadata-list dd').length != 0
|
|
75
|
+
@@doc.css('dl.doc-metadata-list dd').each{ |value|
|
|
75
76
|
if value.text.to_s =~ /minutes/
|
|
76
77
|
@lengthtime = value.text.to_s
|
|
77
78
|
end
|
|
@@ -79,21 +80,21 @@ class PlayResult
|
|
|
79
80
|
end
|
|
80
81
|
end
|
|
81
82
|
|
|
82
|
-
def get_contentrating(
|
|
83
|
-
if doc.css('dd[itemprop=contentRating]').length != 0
|
|
84
|
-
@contentrating = doc.css('dd[itemprop=contentRating]').text
|
|
83
|
+
def get_contentrating()
|
|
84
|
+
if @@doc.css('dd[itemprop=contentRating]').length != 0
|
|
85
|
+
@contentrating = @@doc.css('dd[itemprop=contentRating]').text
|
|
85
86
|
end
|
|
86
87
|
end
|
|
87
88
|
|
|
88
|
-
def get_genre(
|
|
89
|
-
if doc.css('ul.doc-genres .doc-genre-link a:first-child').length != 0
|
|
90
|
-
@genre = doc.css('ul.doc-genres .doc-genre-link a:first-child').text
|
|
89
|
+
def get_genre()
|
|
90
|
+
if @@doc.css('ul.doc-genres .doc-genre-link a:first-child').length != 0
|
|
91
|
+
@genre = @@doc.css('ul.doc-genres .doc-genre-link a:first-child').text
|
|
91
92
|
end
|
|
92
93
|
end
|
|
93
94
|
|
|
94
|
-
def get_related(
|
|
95
|
-
if doc.css('div#related-list ul.snippet-list li div div.details a.title').length != 0
|
|
96
|
-
doc.css('div#related-list ul.snippet-list li div div.details a.title').each{ |value|
|
|
95
|
+
def get_related()
|
|
96
|
+
if @@doc.css('div#related-list ul.snippet-list li div div.details a.title').length != 0
|
|
97
|
+
@@doc.css('div#related-list ul.snippet-list li div div.details a.title').each{ |value|
|
|
97
98
|
@related << value.text.to_s
|
|
98
99
|
}
|
|
99
100
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: google-play
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.7
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -13,7 +13,7 @@ date: 2012-03-06 00:00:00.000000000 Z
|
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: nokogiri
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &70343603707500 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ! '>='
|
|
@@ -21,7 +21,7 @@ dependencies:
|
|
|
21
21
|
version: 1.5.0
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *70343603707500
|
|
25
25
|
description: A simple gem for grabbing Google Play data
|
|
26
26
|
email: me@tdoyle.me
|
|
27
27
|
executables: []
|