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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 792c232731087cc0833ec5d60ac3c6bd70720a74b04fea4a41d70a359f6aab1c
4
- data.tar.gz: e119c64c4158f9d7eae817dd6ddf01f200a445fcc9f627211be17f5e4d1d3ca5
3
+ metadata.gz: e3d656385c095a0e467bce6f9631aefd43bd25bb11a2dd618ff8b97409ba6e4f
4
+ data.tar.gz: c83bcde70fbc596b48e59a10c26fae7457a20b0e65cb6dccae6c6cc65bdf8ca1
5
5
  SHA512:
6
- metadata.gz: b290ced678d97e68eaa2acaaadc2cbf6365819e9bd134b26735dfef431084e727ed00d3383583ed1e53316015b45e8c7d84d9e7dac5de1bf876c67a977c8bdd3
7
- data.tar.gz: 01eaaf89e08b036e86fe199f62154e90ee95bb938143d2c1da243fa8b52071812a3aaaa5a269b3ef87cd85c565c36f31d88de96ee047adbd3bc5567bbba965c2
6
+ metadata.gz: 63e1cc8b81338e3bdb5d49d01b6252122eb82ec735ec57f26e5102ccf94b487b1fe542af0e823bfadc67a73ecb05d1a2bdc8cf5380becda418563992e384678d
7
+ data.tar.gz: 321a936a8f05b408eb50c615569c651f23205d225d29d5805a0b834b36e713f215c5da917cf8e60d67afc0b8582c0019307f2e5dde0cb6cb5d8c2ffa2d202a24
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in templates.gemspec
4
+ gemspec
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
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
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
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,2 @@
1
+ require "nx/version"
2
+ require "nx/xici-proxy"
data/lib/nx/version.rb ADDED
@@ -0,0 +1,5 @@
1
+ module Nx
2
+ class XiciProxy
3
+ VERSION = "0.1.1"
4
+ end
5
+ end
@@ -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.0
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