grab_epg 0.2.7 → 0.2.8
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 +8 -8
- data/.grabepg.gemspec +1 -1
- data/lib/grabepg/grab_base.rb +1 -38
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzE5MGZlNjVlMjcyNjg2NzEwMTNiMjJhNWQ1ZDNiMDdkOTYwNGViYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzVhZjc4NzI5MGIyODI3MmU4OTNkM2Y2ZWE4N2U2NGQwZGYyZTVkMw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Nzk0MWU0NTQ0NGNkNGU4ZmM0YWJiZmRkZDU5ZDRkNjcxYTc2OTBhNDlmNjYw
|
10
|
+
OGZjNDM3YTQ0YTdhMjU5NTBmNmIxNGVhNjRkOTNkMjExZmFjMmNiYTc0ZDNm
|
11
|
+
ZmEzY2ZlNjhhOTEwNGFhYjJhNWU1NTQwMThjZGIxOTllNTM2YTg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OWRjZjA2YTA4NTUyOTM3NjY5NjBjYTkyOTZiYWY1Y2NiZmFhY2NlM2Q4Zjk5
|
14
|
+
ZDZhYTExNGE4MGU1YmMyNDAxYzQ2NDVhY2ViOWZmNWE2ODIyMzFjN2E3Y2U0
|
15
|
+
YzZkYWVlYjIxYzM1OWZiMDExOWI2ZGE4NmI0MjRhMzJkZWI3ZTI=
|
data/.grabepg.gemspec
CHANGED
data/lib/grabepg/grab_base.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#encoding:utf-8
|
2
2
|
require 'nokogiri'
|
3
3
|
require 'iconv'
|
4
|
+
require 'get_proxy_list'
|
4
5
|
|
5
6
|
module Grabepg
|
6
7
|
|
@@ -33,44 +34,6 @@ module Grabepg
|
|
33
34
|
return GetProxyList.get_proxy_in_time_limt(limit,proxy_list)
|
34
35
|
end
|
35
36
|
|
36
|
-
def self.proxy_list(path)
|
37
|
-
proxy_list = []
|
38
|
-
crt_date = DateTime.now.strftime('%F')
|
39
|
-
proxy_path = "%s/tasks/proxy/%s.txt" % [File.dirname(path),crt_date]
|
40
|
-
p "Proxy_Path: #{proxy_path}"
|
41
|
-
if File.exist?(proxy_path)
|
42
|
-
file_proxy = File.open(proxy_path,"r")
|
43
|
-
p "Write in file"
|
44
|
-
file_proxy.each_line {|line|
|
45
|
-
proxy_list << line.chomp.to_s
|
46
|
-
}
|
47
|
-
p "Get Proxy_list:#{proxy_list}"
|
48
|
-
file_proxy.flush
|
49
|
-
file_proxy.close
|
50
|
-
else
|
51
|
-
proxy_list=GetProxyList.get_list(ENV["proxy_limit"].to_i,ENV["proxy_page"].to_i)
|
52
|
-
#proxy_list=["192.168.1.144:2222"]
|
53
|
-
dirpath = "#{File.dirname(path)}/tasks/proxy/"
|
54
|
-
p "**************************************************"
|
55
|
-
p "dirpath=#{dirpath}"
|
56
|
-
Dir.open(dirpath) {|fna|
|
57
|
-
fna.each do |fn|
|
58
|
-
if(fn.to_s != ".." && fn.to_s != ".")
|
59
|
-
File.delete("#{dirpath + fn.to_s}")
|
60
|
-
end
|
61
|
-
end
|
62
|
-
}
|
63
|
-
file_proxy = File.new(proxy_path,"a")
|
64
|
-
proxy_list.each do |proxy|
|
65
|
-
p "Proxy:#{proxy}"
|
66
|
-
file_proxy.puts proxy
|
67
|
-
end
|
68
|
-
file_proxy.flush
|
69
|
-
file_proxy.close
|
70
|
-
end
|
71
|
-
return proxy_list
|
72
|
-
end
|
73
|
-
|
74
37
|
|
75
38
|
#获取指定访问速度的代理服务器
|
76
39
|
#time为最慢速度的时间 int型 代表秒
|