http_crawler 0.3.1.0 → 0.3.1.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/lib/http_crawler/http/response.rb +4 -7
- data/lib/http_crawler/version.rb +1 -1
- data/lib/http_crawler.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87340675519ac599fa1b976dd91d50b15ff57bc5839e84ffb5bf0228b16cfd97
|
4
|
+
data.tar.gz: 337500946e31c4f61de3c935a8892c4021b2cb137b9ee6400c356aefbd2f316b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88fd14e1428db8fae3fbd29f3f3354e5516b7a9e8420d8c86b61f4d63515327e6565e12acc3a68a126f44bef352c924b9e099e5da6ab88da81464f5dc96e4523
|
7
|
+
data.tar.gz: b53f5dccbf5525c0c2e8156bafc6e80ad3f3c0507bfcd7a26457fdcc4934d0a747c3bd017d3292643cc89532bdfa22e2c33ed30b8a5605408b87f234b211048c
|
@@ -3,8 +3,7 @@ module HTTP
|
|
3
3
|
|
4
4
|
# 解压并转码 body 数据
|
5
5
|
def decoding_body
|
6
|
-
return @decoding_body if @decoding_body
|
7
|
-
return nil unless self.body
|
6
|
+
return @decoding_body if defined? @decoding_body
|
8
7
|
|
9
8
|
# 数据解压
|
10
9
|
case self.headers['Content-Encoding']
|
@@ -21,8 +20,6 @@ module HTTP
|
|
21
20
|
@decoding_body = self.body.to_s
|
22
21
|
end
|
23
22
|
|
24
|
-
# @decoding_body = self.body.to_s
|
25
|
-
|
26
23
|
# 判断解压后数据编码格式
|
27
24
|
|
28
25
|
# 从header取编码格式
|
@@ -61,7 +58,7 @@ module HTTP
|
|
61
58
|
# 转换html格式
|
62
59
|
# @return [Nokogiri::HTML::Document]
|
63
60
|
def html
|
64
|
-
return @html if @html
|
61
|
+
return @html if defined? @html
|
65
62
|
self.html = self.dec
|
66
63
|
self.html
|
67
64
|
end
|
@@ -79,7 +76,7 @@ module HTTP
|
|
79
76
|
# 转换json格式
|
80
77
|
# @return [Hash]
|
81
78
|
def json
|
82
|
-
return @json if @json
|
79
|
+
return @json if defined? @json
|
83
80
|
self.json = self.dec
|
84
81
|
self.json
|
85
82
|
end
|
@@ -98,7 +95,7 @@ module HTTP
|
|
98
95
|
# 通过readability 解析数据
|
99
96
|
# @return [Readability::Document]
|
100
97
|
def readability
|
101
|
-
return @readability if @readability
|
98
|
+
return @readability if defined? @readability
|
102
99
|
self.readability = self.dec
|
103
100
|
self.readability
|
104
101
|
end
|
data/lib/http_crawler/version.rb
CHANGED
data/lib/http_crawler.rb
CHANGED