nx-xici-proxy 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 +4 -4
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/README.md +37 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/nx-xici-proxy.rb +2 -0
- data/lib/nx/version.rb +5 -0
- data/lib/nx/xici-proxy.rb +28 -0
- data/nx-xici-proxy-0.1.0.gem +0 -0
- data/nx-xici-proxy.gemspec +35 -0
- metadata +13 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3d656385c095a0e467bce6f9631aefd43bd25bb11a2dd618ff8b97409ba6e4f
|
4
|
+
data.tar.gz: c83bcde70fbc596b48e59a10c26fae7457a20b0e65cb6dccae6c6cc65bdf8ca1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63e1cc8b81338e3bdb5d49d01b6252122eb82ec735ec57f26e5102ccf94b487b1fe542af0e823bfadc67a73ecb05d1a2bdc8cf5380becda418563992e384678d
|
7
|
+
data.tar.gz: 321a936a8f05b408eb50c615569c651f23205d225d29d5805a0b834b36e713f215c5da917cf8e60d67afc0b8582c0019307f2e5dde0cb6cb5d8c2ffa2d202a24
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# nx-xici-proxy
|
2
|
+
> Xici proxy for nx.
|
3
|
+
|
4
|
+
## installation
|
5
|
+
```rb
|
6
|
+
# from gem
|
7
|
+
gem 'nx-xici-proxy'
|
8
|
+
# from git
|
9
|
+
gem 'nx-xici-proxy', git: 'git@github.com:afeiship/nx-xici-proxy.git',ref:'a6b0a57acd05315f97a70c9b45ffbbb7405afa0c'
|
10
|
+
```
|
11
|
+
|
12
|
+
## usage
|
13
|
+
```rb
|
14
|
+
Nx::XiciProxy::fetch
|
15
|
+
|
16
|
+
# result
|
17
|
+
[
|
18
|
+
{
|
19
|
+
:ip=>"138.197.74.25",
|
20
|
+
:port=>"8118"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
:ip=>"167.172.17.86",
|
24
|
+
:port=>"3128"
|
25
|
+
}
|
26
|
+
# ...
|
27
|
+
]
|
28
|
+
```
|
29
|
+
|
30
|
+
## build/publish
|
31
|
+
```shell
|
32
|
+
# build
|
33
|
+
gem build nx-xici-proxy.gemspec
|
34
|
+
|
35
|
+
# publish
|
36
|
+
gem push nx-xici-proxy-0.1.0.gem
|
37
|
+
```
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "nx-xici-proxy"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/nx/version.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require "nokogiri"
|
2
|
+
require "open-uri"
|
3
|
+
|
4
|
+
module Nx
|
5
|
+
class XiciProxy
|
6
|
+
def self.fetch
|
7
|
+
doc = Nokogiri::HTML(
|
8
|
+
open(
|
9
|
+
"https://www.xicidaili.com/",
|
10
|
+
read_timeout: 5,
|
11
|
+
)
|
12
|
+
)
|
13
|
+
|
14
|
+
# process html use selector
|
15
|
+
rows = doc.css("#ip_list tr").slice(0, 22)
|
16
|
+
data = []
|
17
|
+
rows.each_with_index do |row, index|
|
18
|
+
if index > 2
|
19
|
+
ip = row.css("td:nth-child(2)").text
|
20
|
+
port = row.css("td:nth-child(3)").text
|
21
|
+
data << { ip: ip, port: port }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
return data
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
Binary file
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "nx/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "nx-xici-proxy"
|
8
|
+
spec.version = Nx::XiciProxy::VERSION
|
9
|
+
spec.licenses = ["MIT"]
|
10
|
+
spec.authors = ["afeiship"]
|
11
|
+
spec.email = ["1290657123@qq.com"]
|
12
|
+
|
13
|
+
spec.summary = %q{Xici proxy.}
|
14
|
+
spec.description = %q{Xici proxy for nx.}
|
15
|
+
spec.homepage = "https://github.com/afeiship/nx-xici-proxy"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
34
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
35
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nx-xici-proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- afeiship
|
@@ -44,7 +44,18 @@ email:
|
|
44
44
|
executables: []
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
|
-
files:
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- README.md
|
51
|
+
- Rakefile
|
52
|
+
- bin/console
|
53
|
+
- bin/setup
|
54
|
+
- lib/nx-xici-proxy.rb
|
55
|
+
- lib/nx/version.rb
|
56
|
+
- lib/nx/xici-proxy.rb
|
57
|
+
- nx-xici-proxy-0.1.0.gem
|
58
|
+
- nx-xici-proxy.gemspec
|
48
59
|
homepage: https://github.com/afeiship/nx-xici-proxy
|
49
60
|
licenses:
|
50
61
|
- MIT
|