get_proxy_list 0.1.1 → 0.1.3

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWMwNDdjYjQwZTMwZTE2MTg1ZmIxNGI2NTk4NDlhMDdmNGM5MDEyMg==
4
+ MThjYmQ2NjkzOTViODM4NWNhYzE2YzU4NmViYjZmYTY2NjJlZjk0Ng==
5
5
  data.tar.gz: !binary |-
6
- ZGNhOTBjMDAwNzIzZTZjNGY1YWY5MTU4MDdmNWMxZWQzZGM3Zjc1Mg==
6
+ NTI2NDZhYWNiN2RjMzFhZjQ2MWEzYjI5YzE4MmQ1M2UyMjliZmFmYQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OGJmMjIwODcyNzcwZWM5Mjk4M2UxZmYxMGMzNWRmZmYyNjFhYjMxZjU2NmU0
10
- MzI3NzVjMTY3N2IxOWNkMTU1NzhiODk4MDM0MWExMDlkMmM5MTIwMGU2NGM4
11
- MTNhNzA4Mzk5Y2UzNzlmZTg3OTFiNjEyYjQyZWQyZTkyMzE4ZmI=
9
+ NzU3MzJhZGFiOTU0Y2RhZjdiZTk4M2M4YTQ4OGZhNjUwMjY5Nzc2OTc5MDEw
10
+ YmExNWJjMjQ5MDQ3MGFlNzhiZWE4ZDZkNmIwNTU2OTI5ZjZlZDNhMzA0Zjdj
11
+ OWUwYjUwMzhlZDA3ZDdlOTM2MDczMWU4M2ZkNTkzZjYzZDkzM2M=
12
12
  data.tar.gz: !binary |-
13
- MTA4MDllYTEzYjE3NzAyNjAyMjA5Yzk4NzEwOWU2MjgzZjgxNmRlNTc0YTU1
14
- Y2U5Y2E2YjcxYjBhNDcwNzBiZWM5OGU5NGQ2NGE5Y2QyZmNiMWZjZWIyYjk2
15
- MjAyOTY0OTM5NmRmZGIwMTk4NzlhYzkwYThmYmVmZTMxNGFlZTU=
13
+ ODNmYTA3OWFlMjllMGUxMmYzMWJiNmJlMzUwMzkzMjJlOTNhNDIyODg4ZDI1
14
+ ZmQxNjY4MTA2NWVjYzc4NmJhODE5ZDU5ZDExNDIwMGQ2YTBmMDA1ZGQ1MzFh
15
+ M2Y0OGU2MGQ3NGY0OTUxN2ZjMjE1MjNlMDhmMTM1NjE0YWU0MTk=
data/lib/debug.rb CHANGED
@@ -6,7 +6,7 @@ require File.expand_path("../get_proxy_list", __FILE__)
6
6
  class Debug
7
7
  # To change this template use File | Settings | File Templates.
8
8
  include GetProxyList
9
- list= GetProxyList.get_list(0,4)
9
+ list = GetProxyList.proxy_list(1,1,"/home/zql/workspace/New/smart_remote/lib/tasks/proxy/proxy")
10
10
  p "Size: #{list.size}"
11
11
  p "list: #{list}"
12
12
  end
@@ -43,7 +43,7 @@ module GetProxyList
43
43
  end
44
44
  time_use = -1
45
45
  end
46
- if(time_use > 0 &&time_use < limit)
46
+ if(time_use>=0&&time_use<=limit)
47
47
  limit_list << url
48
48
  end
49
49
  end
@@ -1,3 +1,3 @@
1
1
  module Getproxylist
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -3,6 +3,45 @@ require File.expand_path("../get_proxy_list/from_proxy_cn",__FILE__)
3
3
  require File.expand_path("../get_proxy_list/base",__FILE__)
4
4
 
5
5
  module GetProxyList
6
+
7
+ def self.proxy_list(limit,page,proxy_path)
8
+ proxy_list = []
9
+ proxy_path = File.dirname(proxy_path)
10
+ crt_date = DateTime.now.strftime('%F')
11
+ proxy_path = "#{proxy_path}/%s.txt" % [crt_date]
12
+ p "Proxy_Path: #{proxy_path}"
13
+ if File.exist?(proxy_path)
14
+ file_proxy = File.open(proxy_path,"r")
15
+ p "Write in file"
16
+ file_proxy.each_line {|line|
17
+ proxy_list << line.chomp.to_s
18
+ }
19
+ p "Get Proxy_list:#{proxy_list}"
20
+ file_proxy.flush
21
+ file_proxy.close
22
+ else
23
+ proxy_list=get_list(limit,page)
24
+ dirpath = "#{File.dirname(proxy_path)}/"
25
+ p "DirPath=#{dirpath}"
26
+ Dir.open(dirpath) {|fna|
27
+ fna.each do |fn|
28
+ if(fn.to_s != ".." && fn.to_s != ".")
29
+ File.delete("#{dirpath + fn.to_s}")
30
+ end
31
+ end
32
+ }
33
+ file_proxy = File.new(proxy_path,"a")
34
+ proxy_list.each do |proxy|
35
+ p "Proxy:#{proxy}"
36
+ file_proxy.puts proxy
37
+ end
38
+ file_proxy.flush
39
+ file_proxy.close
40
+ end
41
+ return proxy_list
42
+ end
43
+
44
+
6
45
  def self.get_list(limit,page)
7
46
  fromProxyCn = FromProxyCn.new()
8
47
  base = Base.new()
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: get_proxy_list
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - hahazql
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-07 00:00:00.000000000 Z
11
+ date: 2013-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler