list_spider 0.1.0 → 0.1.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: 0f897ec31adc2d2a6c9713729030e8decc85cb9d
4
- data.tar.gz: c81ed9cab5fc1bbd4395aeb9692924887042c27f
3
+ metadata.gz: f73a2e9b358cac55336907ac76ebdb666b9d31f5
4
+ data.tar.gz: 2df50eff29a1963224ca3f7d0cd9b3ac0c89156f
5
5
  SHA512:
6
- metadata.gz: 907529b23336256e2c72232ec2b413c50ebee99df49695bac368ae4dc029afaa81424fe542c63d6c7247714964382e2eaeaae0ea34ab51658e34ce67e5c7b9e7
7
- data.tar.gz: 22dff7b012b1c12f8cefb50606e0a9b0874c5b013a305c268ae2a950374760ba77ed24af075f6ca5217e128d905b31bae754107e0cf063e0d90171dd51b94f20
6
+ metadata.gz: 2cb02f9eb8593a05cc6b0a0c9d015ad93bf08663750d3dfe3007c30febfaa47d57c222960eba3b8e9275fd1f5acb942278180c8b613d8ffc0d983333f059ea8a
7
+ data.tar.gz: a1800a9b27c769adbae11bc8e3f08e5d57d15b3b345d19acbd329142048e742acab8878328e3c8a9053a957c3c27ecf14cd067848d1bc056f552386243c33730
data/lib/list_spider.rb CHANGED
@@ -74,4 +74,8 @@ class ListSpider
74
74
  ListSpider.new(down_list, inter_val: inter_val, max: max).start
75
75
  end
76
76
 
77
+ def self.get_one(task)
78
+ ListSpider.new([task]).start
79
+ end
80
+
77
81
  end
data/lib/spider_base.rb CHANGED
@@ -7,6 +7,7 @@ require "addressable/uri"
7
7
 
8
8
  class TaskStruct
9
9
  def initialize(href, local_path, http_method: :get, params: {}, extra_data: nil, parse_method: nil)
10
+ @origin_href = href
10
11
  @href = href
11
12
  if @href.class == "".class
12
13
  @href = SpiderHelper.string_to_uri(@href)
@@ -22,7 +23,7 @@ class TaskStruct
22
23
  o.class == self.class && o.href == href && o.local_path == local_path && o.http_method == http_method && o.params == params && o.extra_data == extra_data
23
24
  end
24
25
 
25
- attr_accessor :href, :local_path, :http_method, :params, :extra_data, :parse_method
26
+ attr_accessor :origin_href , :href, :local_path, :http_method, :params, :extra_data, :parse_method
26
27
 
27
28
  end
28
29
 
@@ -112,6 +113,7 @@ module SpiderBase
112
113
  }
113
114
  w.errback {
114
115
  puts "errback:#{w.response_header}"
116
+ puts e.origin_href
115
117
  puts e.href
116
118
  puts w.response_header.status
117
119
  failed_list << e
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: list_spider
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Zhang