google_play_search 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module GooglePlaySearch
2
2
  class App
3
- attr_accessor :id, :name, :url, :developer, :category, :logo_url, :short_description
3
+ attr_accessor :id, :name, :url, :developer, :category, :logo_url, :short_description, :point, :reviews
4
4
  end
5
5
  end
@@ -18,6 +18,8 @@ module GooglePlaySearch
18
18
  app.category = get_category app_content
19
19
  app.logo_url = get_logo_url app_content
20
20
  app.short_description = get_short_description app_content
21
+ app.point = get_app_point app_content
22
+ app.reviews = get_app_reviews app_content
21
23
  app_search_result_list << app
22
24
  end
23
25
  app_search_result_list
@@ -51,5 +53,17 @@ module GooglePlaySearch
51
53
  def get_short_description(app_content)
52
54
  app_content.css("div.description").first.content
53
55
  end
56
+
57
+ def get_app_point(app_content)
58
+ point_str = app_content.css("div.ratings").first['title']
59
+ unless point_str.empty?
60
+ return point_str[/\d+\.?\d?/].to_f
61
+ end
62
+ return 0
63
+ end
64
+
65
+ def get_app_reviews(app_content)
66
+ app_content.css("span.snippet-reviews").first.content[1..-2].gsub(',','').to_i
67
+ end
54
68
  end
55
69
  end
@@ -11,7 +11,12 @@ module GooglePlaySearch
11
11
 
12
12
  GOOGLE_PLAY_BASE_SEARCH_URL = $GOOGLE_PLAY_STORE_BASE_URL + "/store/search?q="
13
13
 
14
- DEFAULT_SEARCH_CONDITION = {:language => "en", :category => "apps", :per_page_num => 24}
14
+ DEFAULT_SEARCH_CONDITION = {:language => "en",
15
+ :category => "apps",
16
+ :per_page_num => 24,
17
+ :price => "0",
18
+ :safe_search => "0",
19
+ :sort_by => "1"}
15
20
 
16
21
  def initialize(search_condition = DEFAULT_SEARCH_CONDITION)
17
22
  @search_condition = DEFAULT_SEARCH_CONDITION.merge(search_condition)
@@ -37,6 +42,9 @@ module GooglePlaySearch
37
42
  query_url << @keyword << "&"
38
43
  query_url << "c=" << @search_condition[:category] << "&"
39
44
  query_url << "hl=" << @search_condition[:language] << "&"
45
+ query_url << "price=" << @search_condition[:price] << "&"
46
+ query_url << "safe=" << @search_condition[:safe_search] << "&"
47
+ query_url << "sort=" << @search_condition[:sort_by] << "&"
40
48
  start = (@current_page - 1) * @search_condition[:per_page_num]
41
49
  query_url << "start=#{start}&num=#{@search_condition[:per_page_num]}"
42
50
  end
metadata CHANGED
@@ -1,78 +1,64 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: google_play_search
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 2
9
- version: 0.0.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Grant Chen
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2012-06-03 00:00:00 +08:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-06-03 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: nokogiri
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 1
29
- - 5
30
- - 3
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
31
21
  version: 1.5.3
32
22
  type: :runtime
33
- version_requirements: *id001
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.5.3
34
30
  description: google play market search gem
35
31
  email: kucss@hotmail.com
36
32
  executables: []
37
-
38
33
  extensions: []
39
-
40
34
  extra_rdoc_files: []
41
-
42
- files:
43
- - lib/google_play_search/app_parser.rb
35
+ files:
44
36
  - lib/google_play_search/search.rb
45
37
  - lib/google_play_search/app.rb
38
+ - lib/google_play_search/app_parser.rb
46
39
  - lib/google_play_search.rb
47
- has_rdoc: true
48
40
  homepage: https://github.com/kucss/google_play_search
49
41
  licenses: []
50
-
51
42
  post_install_message:
52
43
  rdoc_options: []
53
-
54
- require_paths:
44
+ require_paths:
55
45
  - lib
56
- required_ruby_version: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- segments:
61
- - 0
62
- version: "0"
63
- required_rubygems_version: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- segments:
68
- - 0
69
- version: "0"
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
70
58
  requirements: []
71
-
72
59
  rubyforge_project:
73
- rubygems_version: 1.3.6
60
+ rubygems_version: 1.8.19
74
61
  signing_key:
75
62
  specification_version: 3
76
63
  summary: google play market search
77
64
  test_files: []
78
-