amazon-search 1.2.0 → 1.2.1

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: 926a9458dfada7f776d237ef062df5417a8844ab
4
- data.tar.gz: a5f8d92ff7e15f3caec347da18b35e2251595841
3
+ metadata.gz: 9d34643d6bb26f18ac331af2887673000fce1d8e
4
+ data.tar.gz: aff9e145005c2d5362f4c8465bc16bddefa418a9
5
5
  SHA512:
6
- metadata.gz: db4b59801f639a46740400dac687977cf284fd14833ca942eabf05d5cc5544f09c46f3b6c169d5c4dee6fbcb95203d83a2efb64ebb0d7fe70b34e1ce63b3b746
7
- data.tar.gz: e27a6cec55a33aa2b1cc594ff71e2e1bbb9059cb5e741254e6530f937f7d8e7a05357c90c69f6d462bd7aaebfc5d7a3e531d1b35e3b4228b39008d6420e46cd1
6
+ metadata.gz: 8d80a1fb04a7bfe50baa173255942713b84c160c3e0d73a094b8d635ec2ef2017cfebc72514a49a3b6e8187a4fff9dd1487747eb86018383119bad012fe26491
7
+ data.tar.gz: bd413ecd5459d464c551fb621d073550c45002c67f01d2be50ce1c2136ff1767cf79ca9d9a8a9d9c318a2647602cc5bb79f68cd55eeda5e21de702c6052beb18
data/Readme.rdoc CHANGED
@@ -22,7 +22,7 @@ This is a tool that does not require configuration of Amazon's API. The functio
22
22
 
23
23
  == GOTCHAS
24
24
 
25
- If you are unable to establish an HTTPS connection, this program will not work. 503 errors will occur and the search will fail. 90% of the time, a simply retry will fix the issue. Working on getting a fix soon!
25
+ Sometimes a 503 error occurs due to the pagination scanning too quickly and overloading the server. An option will come out in the future to customize how long to sleep before requesting next page of search results. In the meantime, a simple retry will often work.
26
26
 
27
27
  == MIT LICENSE
28
28
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = %q{amazon-search}
5
- gem.version = '1.2.0'
5
+ gem.version = '1.2.1'
6
6
  gem.date = '2015-09-18'
7
7
  gem.platform = Gem::Platform::RUBY
8
8
  gem.required_ruby_version = '>= 1.8'
data/lib/amazon-search.rb CHANGED
@@ -7,7 +7,8 @@ module Amazon
7
7
  class Search
8
8
  def self.find_products(keywords)
9
9
  #--------- submit the search form with keywords ---------------------
10
- agent = Mechanize.new
10
+ agent = Mechanize.new{ |a| a.user_agent_alias = "Mac Safari"} # set browser
11
+
11
12
  main_page = agent.get("http://amazon.com")
12
13
  search_form = main_page.form_with :name => "site-search" # find the search form in Amazon
13
14
 
@@ -33,6 +34,7 @@ class Search
33
34
  end # ends pagination loop
34
35
 
35
36
  puts "\n\n(end of search results)"
37
+ sleep(1) # don't overload the servers
36
38
  end
37
39
 
38
40
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amazon-search
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mason