amazon-search 1.1.12 → 1.2.0
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 +8 -3
- data/amazon-search.gemspec +1 -1
- data/lib/amazon-search.rb +2 -2
- 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: 926a9458dfada7f776d237ef062df5417a8844ab
|
4
|
+
data.tar.gz: a5f8d92ff7e15f3caec347da18b35e2251595841
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db4b59801f639a46740400dac687977cf284fd14833ca942eabf05d5cc5544f09c46f3b6c169d5c4dee6fbcb95203d83a2efb64ebb0d7fe70b34e1ce63b3b746
|
7
|
+
data.tar.gz: e27a6cec55a33aa2b1cc594ff71e2e1bbb9059cb5e741254e6530f937f7d8e7a05357c90c69f6d462bd7aaebfc5d7a3e531d1b35e3b4228b39008d6420e46cd1
|
data/Readme.rdoc
CHANGED
@@ -12,12 +12,17 @@ This is a tool that does not require configuration of Amazon's API. The functio
|
|
12
12
|
|
13
13
|
require 'amazon-search'
|
14
14
|
|
15
|
-
# Search for products by
|
15
|
+
# Search for products by keyword string and store results
|
16
16
|
Amazon::Search.find_products "ruby"
|
17
|
+
Amazon::Search.find_products "books"
|
18
|
+
Amazon::Search.find_products "games"
|
17
19
|
|
18
|
-
|
19
|
-
# puts results
|
20
|
+
# After a search is complete, run this command
|
20
21
|
Amazon::Search.display_results
|
22
|
+
|
23
|
+
== GOTCHAS
|
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!
|
21
26
|
|
22
27
|
== MIT LICENSE
|
23
28
|
|
data/amazon-search.gemspec
CHANGED
data/lib/amazon-search.rb
CHANGED
@@ -15,7 +15,7 @@ class Search
|
|
15
15
|
search_results = agent.submit search_form # submits form
|
16
16
|
|
17
17
|
#--------- scan each page and store the results ---------------------
|
18
|
-
|
18
|
+
$product_divs = []
|
19
19
|
page_num = 0
|
20
20
|
next_page = agent.get(search_results.uri) # initial search results are the first page
|
21
21
|
|
@@ -26,7 +26,7 @@ class Search
|
|
26
26
|
page_num += 1
|
27
27
|
page = agent.get(next_page.uri) # load the next page
|
28
28
|
|
29
|
-
|
29
|
+
$product_divs << page.search('//li[starts-with(@id, "result")]') # store the div of each product
|
30
30
|
|
31
31
|
next_page_link = page.link_with text: /Next Page/ # find the next page link
|
32
32
|
next_page = next_page_link.click unless page_num == last_page_num # click to next page unless on last page
|