amazon-search 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/amazon-search.rb +8 -7
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 158b6c001ca75de6db5932613400e66da3bcee12
|
4
|
+
data.tar.gz: b704070c66c130cc3ec7dbc36e9b10a2e847d18b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03251d475f4544cf5aa91bd444dfddb16a225b1863e4afdabc32aa44d6e591814f2e886bd7599c0b88903e8445ab7810fbaee26eae266d9e1c09f67af541f781
|
7
|
+
data.tar.gz: c14203ba29639639933c6798d0edc4b02fce4e441b87e621ab4ccc7bff00e7fcebd64190960a812120176d9d2d523055d722e40a2b2a393202b9240a12186e4c
|
data/lib/amazon-search.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'mechanize'
|
4
|
+
require 'thor'
|
4
5
|
|
6
|
+
def search(keywords)
|
5
7
|
###########################################
|
6
8
|
# Select Amazon search form and submit
|
7
9
|
# the search criteria
|
@@ -11,9 +13,7 @@ agent = Mechanize.new
|
|
11
13
|
main_page = agent.get("http://amazon.com")
|
12
14
|
search_form = main_page.form_with :name => "site-search"
|
13
15
|
|
14
|
-
keywords
|
15
|
-
|
16
|
-
if ARGV[0] # did user enter in search keywords?
|
16
|
+
if keywords.nil? false # did user enter in search keywords?
|
17
17
|
search_form.field_with(:name => "field-keywords").value = keywords # sets value of search box
|
18
18
|
search_results = agent.submit search_form # submits form
|
19
19
|
|
@@ -106,10 +106,11 @@ STDOUT.puts <<-EOF
|
|
106
106
|
Please provide search keywords
|
107
107
|
|
108
108
|
Example Usage:
|
109
|
-
|
110
|
-
|
111
|
-
|
109
|
+
search watches
|
110
|
+
search books
|
111
|
+
search games
|
112
112
|
|
113
113
|
EOF
|
114
114
|
|
115
|
-
end # ends ARGV if statement
|
115
|
+
end # ends ARGV if statement
|
116
|
+
end
|
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.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mason
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thor
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.19'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.19'
|
27
41
|
description: Simple screenscraper to search Amazon and return product titles, urls,
|
28
42
|
image href, etc.
|
29
43
|
email: mace2345@gmail.com
|