google_play_search 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b6c6d9904e4e95f237945ab0945975624d80a2c
4
- data.tar.gz: 310d5be7e53b3e4fbd7ba779f41bcb80e3c54274
3
+ metadata.gz: bf7c31a06fe864d133224e62a0cf97a21ce24922
4
+ data.tar.gz: 9c92cabac9058324ffde32430ee92744fc8f796f
5
5
  SHA512:
6
- metadata.gz: afdcba6273839fd59aed5574c475223236d613f1f2427c54008676caf8778bdb8c7f669c31ebdc6df3718cb343365bcc625bd514ef85408f3ef4f134ca746e90
7
- data.tar.gz: 4955076d469b0da3cbd39ed613914e13586a88ad06aad72d27d7dad91cba66591d0cd1eecb4b04601125fb74b4644e1e21f01f873656f6d6683a59507e32fdd3
6
+ metadata.gz: bf92ce8cd90750d47bae442505c43757d2e21696d8c8a031386eddb97d4dd41e7934c9e67adb2d599103211f37f75a504fc73b789b2b48635298de8d7e12c813
7
+ data.tar.gz: afbb51a30149912eb4c0616cc3e2e8a344437089dbe2727971aed6b02d7db818130db685766e9c0d59f4167d5a0c4f1233207790f32293e1da939d924813f145
@@ -1,10 +1,13 @@
1
1
  require 'open-uri'
2
+ require File.expand_path(File.dirname(__FILE__) + '/review')
3
+
2
4
  module GooglePlaySearch
3
5
  class App
4
6
  attr_accessor :id, :name, :url, :developer, :category, :logo_url,
5
7
  :short_description, :rating, :reviews, :price,
6
8
  :version, :installs, :last_updated, :size,
7
- :requires_android, :content_rating
9
+ :requires_android, :content_rating, :developer_website,
10
+ :developer_email, :developer_address
8
11
 
9
12
  def get_all_details()
10
13
  html = open(self.url).read()
@@ -17,6 +20,10 @@ module GooglePlaySearch
17
20
  self.requires_android = get_requires_android(google_play_html)
18
21
  self.content_rating = get_content_rating(google_play_html)
19
22
  self.category = get_category(google_play_html)
23
+ self.developer_website = get_developer_website(google_play_html)
24
+ self.developer_email = get_developer_email(google_play_html)
25
+ self.developer_address = get_developer_address(google_play_html)
26
+ self.reviews = get_reviews(google_play_html)
20
27
  self
21
28
  rescue
22
29
  self
@@ -51,5 +58,32 @@ module GooglePlaySearch
51
58
  def get_category(google_play_html)
52
59
  google_play_html.search("span[itemprop='genre']").first.content.strip
53
60
  end
61
+
62
+ def get_developer_website(google_play_html)
63
+ 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)]
65
+ end
66
+
67
+ def get_developer_email(google_play_html)
68
+ google_play_html.search("a[class='dev-link']").last.content.strip.gsub("Email ", "")
69
+ end
70
+
71
+ def get_developer_address(google_play_html)
72
+ google_play_html.search("div[class='content physical-address']").first.content.strip
73
+ end
74
+
75
+ def get_reviews(google_play_html)
76
+ reviews = []
77
+ google_play_html.search("div[class='single-review']").each do |ele|
78
+ review = GooglePlaySearch::Review.new()
79
+ review.author_name = ele.search("span[class='author-name']").first.content.strip
80
+ review.author_avatar = ele.search("img[class='author-image']").first['src'].strip
81
+ review.review_title = ele.search("span[class='review-title']").first.content.strip
82
+ review.review_content = ele.search("div[class='review-body']").children[2].content.strip
83
+ review.star_rating = ele.search("div[class='tiny-star star-rating-non-editable-container']").first['aria-label'].scan(/\d/).first.to_i
84
+ reviews << review
85
+ end
86
+ reviews
87
+ end
54
88
  end
55
89
  end
@@ -78,13 +78,6 @@ module GooglePlaySearch
78
78
  end
79
79
  end
80
80
 
81
- def get_app_reviews(app_content)
82
- reviews = app_content.css("span.snippet-reviews")
83
- if reviews && reviews.size > 0
84
- reviews.first.content[1..-2].gsub(',','').to_i
85
- end
86
- end
87
-
88
81
  def get_app_price(app_content)
89
82
  prices = app_content.css("div.details span.price-container button.price span")
90
83
  if prices and prices.first
@@ -0,0 +1,5 @@
1
+ module GooglePlaySearch
2
+ class Review
3
+ attr_accessor :author_name, :author_avatar, :star_rating, :review_title, :review_content
4
+ end
5
+ 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.13
4
+ version: 0.0.14
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-14 00:00:00.000000000 Z
11
+ date: 2015-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -33,6 +33,7 @@ files:
33
33
  - lib/google_play_search.rb
34
34
  - lib/google_play_search/app.rb
35
35
  - lib/google_play_search/app_parser.rb
36
+ - lib/google_play_search/review.rb
36
37
  - lib/google_play_search/search.rb
37
38
  homepage: https://github.com/grantchen/google_play_search
38
39
  licenses: