amazon-search 1.2.0 → 1.2.1
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.
- checksums.yaml +4 -4
- data/Readme.rdoc +1 -1
- data/amazon-search.gemspec +1 -1
- data/lib/amazon-search.rb +3 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d34643d6bb26f18ac331af2887673000fce1d8e
|
4
|
+
data.tar.gz: aff9e145005c2d5362f4c8465bc16bddefa418a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
|
data/amazon-search.gemspec
CHANGED
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
|
|