amazon_dp 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/amazon_dp/fetcher.rb +11 -1
- data/lib/amazon_dp/version.rb +1 -1
- metadata +3 -4
data/lib/amazon_dp/fetcher.rb
CHANGED
@@ -8,6 +8,7 @@ require 'logger'
|
|
8
8
|
module AmazonDP
|
9
9
|
class Fetcher
|
10
10
|
ADULT_AUTH_URL = "http://www.amazon.co.jp/gp/product/black-curtain-redirect.html"
|
11
|
+
CERO_AUTH_URL = "http://www.amazon.co.jp/gp/product/cero-black-curtain-redirect.html"
|
11
12
|
PERMALINK_URL = "http://www.amazon.co.jp/gp/product/[ASIN_CODE]?ie=UTF8&redirect=true"
|
12
13
|
USER_AGENT = "w3m/0.5.2"
|
13
14
|
|
@@ -19,6 +20,7 @@ module AmazonDP
|
|
19
20
|
def initialize(opts={})
|
20
21
|
@user_agent = opts[:user_agent] ? opts[:user_agent] : USER_AGENT
|
21
22
|
@adult_auth_url = opts[:adult_auth_url] ? opts[:adult_auth_url] : ADULT_AUTH_URL
|
23
|
+
@cero_auth_url = opts[:cero_auth_url] ? opts[:cero_auth_url] : CERO_AUTH_URL
|
22
24
|
@permalink_url = opts[:permalink_url] ? opts[:permalink_url] : PERMALINK_URL
|
23
25
|
@agent = Mechanize.new{ |agent|
|
24
26
|
agent.user_agent = @user_agent
|
@@ -28,7 +30,15 @@ module AmazonDP
|
|
28
30
|
def adult_auth
|
29
31
|
@@logger.info "try adult authentication"
|
30
32
|
@agent.redirect_ok = false
|
31
|
-
|
33
|
+
@agent.get(@adult_auth_url)
|
34
|
+
@agent.redirect_ok = true
|
35
|
+
@@logger.info "adult authentication done"
|
36
|
+
end
|
37
|
+
|
38
|
+
def cero_auth
|
39
|
+
@@logger.info "try cero authentication"
|
40
|
+
@agent.redirect_ok = false
|
41
|
+
@agent.get(@cero_auth_url)
|
32
42
|
@agent.redirect_ok = true
|
33
43
|
@@logger.info "adult authentication done"
|
34
44
|
end
|
data/lib/amazon_dp/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amazon_dp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-21 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Amazon Description of Product page parser
|
15
15
|
email:
|
@@ -51,9 +51,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
51
|
version: '0'
|
52
52
|
requirements: []
|
53
53
|
rubyforge_project:
|
54
|
-
rubygems_version: 1.8.
|
54
|
+
rubygems_version: 1.8.23
|
55
55
|
signing_key:
|
56
56
|
specification_version: 3
|
57
57
|
summary: Amazon Description of Product page parser
|
58
58
|
test_files: []
|
59
|
-
has_rdoc:
|