market_bot 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.1
1
+ 0.8.2
@@ -142,16 +142,17 @@ module MarketBot
142
142
  def initialize(app_id, options={})
143
143
  @app_id = app_id
144
144
  @hydra = options[:hydra] || MarketBot.hydra
145
+ @request_opts = options[:request_opts] || {}
145
146
  @callback = nil
146
147
  @error = nil
147
148
  end
148
149
 
149
150
  def market_url
150
- "https://play.google.com/store/apps/details?id=#{@app_id}"
151
+ "https://play.google.com/store/apps/details?id=#{@app_id}&hl=en"
151
152
  end
152
153
 
153
154
  def update
154
- resp = Typhoeus::Request.get(market_url)
155
+ resp = Typhoeus::Request.get(market_url, @request_opts)
155
156
  result = App.parse(resp.body)
156
157
  update_callback(result)
157
158
 
@@ -162,7 +163,7 @@ module MarketBot
162
163
  @callback = block
163
164
  @error = nil
164
165
 
165
- request = Typhoeus::Request.new(market_url)
166
+ request = Typhoeus::Request.new(market_url, @request_opts)
166
167
 
167
168
  request.on_complete do |response|
168
169
  # HACK: Typhoeus <= 0.4.2 returns a response, 0.5.0pre returns the request.
@@ -20,7 +20,7 @@ module MarketBot
20
20
  url = "https://play.google.com/store/apps/developer?"
21
21
  url << "id=#{URI.escape(identifier)}&"
22
22
  url << "start=#{start_val}&"
23
- url << "num=12"
23
+ url << "num=12&hl=en"
24
24
 
25
25
  results << url
26
26
  end
@@ -33,7 +33,7 @@ module MarketBot
33
33
  result[:price_usd] = details_node.css('.buy-button-price').children.first.text.gsub(' Buy', '')
34
34
  result[:developer] = details_node.css('.attribution').children.first.text
35
35
  result[:market_id] = details_node.css('.title').first.attributes['href'].to_s.gsub('/store/apps/details?id=', '').gsub(/&feature=.*$/, '')
36
- result[:market_url] = "https://play.google.com/store/apps/details?id=#{result[:market_id]}"
36
+ result[:market_url] = "https://play.google.com/store/apps/details?id=#{result[:market_id]}&hl=en"
37
37
 
38
38
  result[:price_usd] = '$0.00' if result[:price_usd] == 'Install'
39
39
 
@@ -55,7 +55,7 @@ module MarketBot
55
55
  result[:price_usd] = nil
56
56
  result[:developer] = snippet_node.css('.attribution').text
57
57
  result[:market_id] = snippet_node.attributes['data-docid'].text
58
- result[:market_url] = "https://play.google.com/store/apps/details?id=#{result[:market_id]}"
58
+ result[:market_url] = "https://play.google.com/store/apps/details?id=#{result[:market_id]}&hl=en"
59
59
 
60
60
  results << result
61
61
  end
@@ -67,6 +67,7 @@ module MarketBot
67
67
  @identifier = identifier
68
68
  @category = category
69
69
  @hydra = options[:hydra] || MarketBot.hydra
70
+ @request_opts = options[:request_opts] || {}
70
71
  @parsed_results = []
71
72
  end
72
73
 
@@ -83,7 +84,7 @@ module MarketBot
83
84
  url << "/category/#{category.to_s.upcase}" if category
84
85
  url << "/collection/#{identifier.to_s}?"
85
86
  url << "start=#{start_val}"
86
- url << "&num=24"
87
+ url << "&num=24&hl=en"
87
88
 
88
89
  results << url
89
90
  end
@@ -93,7 +94,7 @@ module MarketBot
93
94
 
94
95
  def enqueue_update(options={})
95
96
  if @identifier.to_s.downcase == 'editors_choice' && category == nil
96
- url = 'https://play.google.com/store/apps/collection/editors_choice'
97
+ url = 'https://play.google.com/store/apps/collection/editors_choice?&hl=en'
97
98
  process_page(url, 1)
98
99
  else
99
100
  min_rank = options[:min_rank] || 1
@@ -129,7 +130,7 @@ module MarketBot
129
130
 
130
131
  private
131
132
  def process_page(url, page_num)
132
- request = Typhoeus::Request.new(url)
133
+ request = Typhoeus::Request.new(url, @request_opts)
133
134
  request.on_complete do |response|
134
135
  # HACK: Typhoeus <= 0.4.2 returns a response, 0.5.0pre returns the request.
135
136
  response = response.response if response.is_a?(Typhoeus::Request)
@@ -20,7 +20,7 @@ module MarketBot
20
20
  url = "https://play.google.com/store/search?"
21
21
  url << "q=#{URI.escape(identifier)}&"
22
22
  url << "c=apps&start=#{start_val}&"
23
- url << "num=24"
23
+ url << "num=24&hl=en"
24
24
 
25
25
  results << url
26
26
  end
data/market_bot.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "market_bot"
8
- s.version = "0.8.1"
8
+ s.version = "0.8.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Chad Remesch"]
12
- s.date = "2012-07-22"
12
+ s.date = "2012-08-19"
13
13
  s.description = "Market Bot is a high performance Ruby scraper for Google's Android Market with a simple to use API. It is built on top of Nokogiri and Typhoeus."
14
14
  s.email = "chad@remesch.com"
15
15
  s.extra_rdoc_files = [
@@ -51,7 +51,7 @@ Gem::Specification.new do |s|
51
51
  s.homepage = "http://github.com/chadrem/market_bot"
52
52
  s.licenses = ["MIT"]
53
53
  s.require_paths = ["lib"]
54
- s.rubygems_version = "1.8.23"
54
+ s.rubygems_version = "1.8.24"
55
55
  s.summary = "Market Bot: High performance Ruby scraper for Google's Android Market"
56
56
 
57
57
  if s.respond_to? :specification_version then
@@ -23,7 +23,7 @@ def check_getters(app)
23
23
  app.votes.should == '6'
24
24
  app.more_from_developer.should == [{:app_id=>"com.bluefroggaming.ghost_chicken"}]
25
25
  app.users_also_installed.should == [{:app_id=>"com.mudstuffingindustries.redneckjellyfish"}, {:app_id=>"com.lyote.blurt"}, {:app_id=>"com.donutman.rosham"}, {:app_id=>"jscompany.games.separatetrash_lite"}]
26
- app.related.should == [{:app_id=>"com.popcasuals.bubblepop2"}, {:app_id=>"com.lsgvgames.slideandflyfull"}, {:app_id=>"com.trendy.ddapp"}, {:app_id=>"com.rubicon.dev.glwg"}]
26
+ app.related.should == [{:app_id=>"com.popcasuals.bubblepop2"}, {:app_id=>"com.jakyl.aftermathxhd"}, {:app_id=>"com.lsgvgames.slideandflyfull"}, {:app_id=>"com.rubicon.dev.glwg"}]
27
27
  app.banner_icon_url.should == 'https://lh3.ggpht.com/e6QqjMM9K__moeCm2C5HRb0SmGX0XqzhnhiE1MUx8MdNVdQbQW9rhFX_qmtbtBxHAa0=w124'
28
28
  app.banner_image_url.should == 'https://lh6.ggpht.com/hh-pkbt1mEbFg7CJt2DSum7WDtnKS8jWPYrMwPbE2LY_qvNQa6CZLpseQHX6PVJ1RA=w705'
29
29
  app.website_url.should == 'http://bluefroggaming.com'
@@ -50,7 +50,7 @@ describe 'App' do
50
50
  end
51
51
 
52
52
  it 'should generate market URLs' do
53
- App.new(test_id).market_url.should == "https://play.google.com/store/apps/details?id=#{test_id}"
53
+ App.new(test_id).market_url.should == "https://play.google.com/store/apps/details?id=#{test_id}&hl=en"
54
54
  end
55
55
 
56
56
  context 'Parsing' do
@@ -86,15 +86,15 @@ describe 'App' do
86
86
 
87
87
  result[:title].should == 'Evernote'
88
88
  result[:rating].should == '4.7'
89
- result[:updated].should == 'June 10, 2012'
90
- result[:current_version].should == '4.0.4'
89
+ result[:updated].should == 'July 25, 2012'
90
+ result[:current_version].should == '4.1.1'
91
91
  result[:requires_android].should == '1.6 and up'
92
92
  result[:category].should == 'Productivity'
93
- result[:size].should == '7.7M'
93
+ result[:size].should == '7.5M'
94
94
  result[:price].should == 'Free'
95
95
  result[:content_rating].should == 'Low Maturity'
96
96
  result[:description].should =~ /^Evernote turns your Android device into an extension/
97
- result[:votes].should == '342,274'
97
+ result[:votes].should == '355,716'
98
98
  result[:developer].should == 'Evernote Corp.'
99
99
  result[:installs].should == '10,000,000 - 50,000,000'
100
100
  result[:banner_icon_url].should == 'https://lh4.ggpht.com/YpRePJZ4TJUCdERkX-E0uUq6jhaofOS1szIejmo3DZm4oEq82AqcUpoj9FHOxFRvprU=w124'
@@ -102,8 +102,8 @@ describe 'App' do
102
102
  result[:website_url].should == 'http://www.evernote.com'
103
103
  result[:email].should == nil
104
104
  result[:youtube_video_ids].should == ['Ag_IGEgAa9M']
105
- result[:screenshot_urls].should == ["https://lh3.ggpht.com/Q_vPAtKVUefD3znGi_8AnK3FHDf8XsegMnVrX2sImaFLKXOC__MWKXW2WY1avhlvF_aK=h230", "https://lh6.ggpht.com/nbz5tSvuuydrcQ5kl2PpaFuPBrEgXRPaEXXecLMNXEGVblUlDoTXCRH22GrM2RYFcA=h230", "https://lh3.ggpht.com/Oi0lpkA23XsHjg_cXyXkOaRtNw84_OR_YtzhZUCe8VhWRej8oCT28I0VD8Z5ixSuCyM=h230", "https://lh4.ggpht.com/EfNdIkRr5T0JQQlvPICl6m3gHCDBEnsMxqZMrXb0qMW9xBQCN10PaPdrKVI-07XzsXs=h230", "https://lh4.ggpht.com/Q4BDQRkuvHMglh5I0aG56Yy_29NnBWxXWTqkv21onHM41pnrHoLnkacQFmqr6SVtuUR4=h230", "https://lh3.ggpht.com/Uf4MqnyMPVEFATlkutnXVyBtUQEkJbBLQREXbBI633wHAeBxhAc2-XSuysMM5ZFC7f7j=h230", "https://lh5.ggpht.com/TFSxb_0qi1RcDLI6ezzpB5yYfk8rqYWvDjmE30z6AGdmeVSsmomlmGAW0aT8yCA0jpk0=h230", "https://lh4.ggpht.com/Zeet2wggJms4BpDTglJP0jW9M3EAjpn0zUWNKZk6YKM9Id4SPBID5LtKJAgd-krtXZ8=h230"]
106
- result[:whats_new].should == "<p>What's in this version:</p>- Activate menu button in settings/other options. Use it to toggle the action bar.<br>- Performance improvement of list scrolling.<br>- Major other bug fixes and enhancements.<br>"
105
+ result[:screenshot_urls].should == ["https://lh3.ggpht.com/Q_vPAtKVUefD3znGi_8AnK3FHDf8XsegMnVrX2sImaFLKXOC__MWKXW2WY1avhlvF_aK=h230", "https://lh6.ggpht.com/nbz5tSvuuydrcQ5kl2PpaFuPBrEgXRPaEXXecLMNXEGVblUlDoTXCRH22GrM2RYFcA=h230", "https://lh3.ggpht.com/Oi0lpkA23XsHjg_cXyXkOaRtNw84_OR_YtzhZUCe8VhWRej8oCT28I0VD8Z5ixSuCyM=h230", "https://lh4.ggpht.com/EfNdIkRr5T0JQQlvPICl6m3gHCDBEnsMxqZMrXb0qMW9xBQCN10PaPdrKVI-07XzsXs=h230", "https://lh4.ggpht.com/Q4BDQRkuvHMglh5I0aG56Yy_29NnBWxXWTqkv21onHM41pnrHoLnkacQFmqr6SVtuUR4=h230", "https://lh3.ggpht.com/Uf4MqnyMPVEFATlkutnXVyBtUQEkJbBLQREXbBI633wHAeBxhAc2-XSuysMM5ZFC7f7j=h230", "https://lh4.ggpht.com/02wkEgVmPPLwcMJc_YPnXpiYf3v3obz9yf2SIC7WwLVYjjYHJB48DFioTyAbbS1xiw=h230", "https://lh5.ggpht.com/k6LCn2yoTQH3ofLr4uycKRnhDZTvB9RcPlyIrUIaIpFSgHcAz4_2LKQfSZPC44YFxw=h230"]
106
+ result[:whats_new].should == "<p>What's in this version:</p>Major Android tablet enhancements!<br>- Completely new tablet look and feel<br>New home screen lets you create and find your notes easily<br>- Swipe navigation on tablets<br>Swipe right to jump to the home screen from a note or note list<br>- Space-saving List View on tablets<br>Phone and tablet improvements:<br>- Create sublists<br>Add levels to your lists by tapping the arrows in the formatting bar when the cursor is in an existing list<br>"
107
107
  result[:permissions].should == [{:security=>"dangerous", :group=>"Hardware controls", :description=>"record audio", :description_full=>"Allows the app to access the audio record path."}, {:security=>"dangerous", :group=>"Hardware controls", :description=>"take pictures and videos", :description_full=>"Allows the app to take pictures and videos with the camera. This allows the app at any time to collect images the camera is seeing."}, {:security=>"dangerous", :group=>"Your location", :description=>"coarse (network-based) location", :description_full=>"Access coarse location sources such as the cellular network database to determine an approximate tablet location, where available. Malicious apps may use this to determine approximately where you are. Access coarse location sources such as the cellular network database to determine an approximate phone location, where available. Malicious apps may use this to determine approximately where you are."}, {:security=>"dangerous", :group=>"Your location", :description=>"fine (GPS) location", :description_full=>"Access fine location sources such as the Global Positioning System on the tablet, where available. Malicious apps may use this to determine where you are, and may consume additional battery power. Access fine location sources such as the Global Positioning System on the phone, where available. Malicious apps may use this to determine where you are, and may consume additional battery power."}, {:security=>"dangerous", :group=>"Network communication", :description=>"full Internet access", :description_full=>"Allows the app to create network sockets."}, {:security=>"dangerous", :group=>"Your personal information", :description=>"read contact data", :description_full=>"Allows the app to read all of the contact (address) data stored on your tablet. Malicious apps may use this to send your data to other people. Allows the app to read all of the contact (address) data stored on your phone. Malicious apps may use this to send your data to other people."}, {:security=>"dangerous", :group=>"Your personal information", :description=>"read sensitive log data", :description_full=>"Allows the app to read from the system's various log files. This allows it to discover general information about what you are doing with the tablet, potentially including personal or private information. Allows the app to read from the system's various log files. This allows it to discover general information about what you are doing with the phone, potentially including personal or private information."}, {:security=>"dangerous", :group=>"Your personal information", :description=>"read calendar events plus confidential information", :description_full=>"Allows the app to read all calendar events stored on your tablet, including those of friends or coworkers. Malicious apps may extract personal information from these calendars without the owners' knowledge. Allows the app to read all calendar events stored on your phone, including those of friends or coworkers. Malicious apps may extract personal information from these calendars without the owners' knowledge."}, {:security=>"dangerous", :group=>"Phone calls", :description=>"read phone state and identity", :description_full=>"Allows the app to access the phone features of the device. An app with this permission can determine the phone number and serial number of this phone, whether a call is active, the number that call is connected to and the like."}, {:security=>"dangerous", :group=>"Storage", :description=>"modify/delete USB storage contents modify/delete SD card contents", :description_full=>"Allows the app to write to the USB storage. Allows the app to write to the SD card."}, {:security=>"dangerous", :group=>"System tools", :description=>"prevent tablet from sleeping prevent phone from sleeping", :description_full=>"Allows the app to prevent the tablet from going to sleep. Allows the app to prevent the phone from going to sleep."}, {:security=>"safe", :group=>"Your accounts", :description=>"discover known accounts", :description_full=>"Allows the app to get the list of accounts known by the tablet. Allows the app to get the list of accounts known by the phone."}, {:security=>"safe", :group=>"Hardware controls", :description=>"control vibrator", :description_full=>"Allows the app to control the vibrator."}, {:security=>"safe", :group=>"Network communication", :description=>"view network state", :description_full=>"Allows the app to view the state of all networks."}, {:security=>"safe", :group=>"Network communication", :description=>"view Wi-Fi state", :description_full=>"Allows the app to view the information about the state of Wi-Fi."}, {:security=>"safe", :group=>"Default", :description=>"Market billing service", :description_full=>"Allows the user to purchase items through Market from within this application"}]
108
108
  end
109
109