nx-us-proxy 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 12aabc8df157fe04801796320323d032b9944b9179570f3ad8a83be17cabe906
4
+ data.tar.gz: 828c8ee5dbb74baeb967f0b107311e74deb71b128a3cfd5639efad497494546f
5
+ SHA512:
6
+ metadata.gz: 01fabc451b7fd8b908f3f59a29bbf2772b5ea8735d5e4f69353230bf4b0fc3978e0bb799a7a82243b362e57a5f3c4320c2985e1952434fe9159e8943c44333be
7
+ data.tar.gz: 916a06b905c93cc3282109536f94cfa4f418f8c46eea48e17eb3fd25dcaf52cea2a026733018d5930e3de23b560d0b5ebc01c8ab0a06873d6845985bff6bda26
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,28 @@
1
+ # nx-us-proxy
2
+ > Get us free proxies for ruby.
3
+
4
+ ## installation
5
+ ```rb
6
+ # from gem
7
+ gem 'nx-us-proxy'
8
+ # from git
9
+ gem 'nx-us-proxy', git: 'git@github.com:afeiship/nx-us-proxy.git'
10
+ ```
11
+
12
+ ## usage
13
+ ```rb
14
+ Nx::UsProxy::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
+ ```
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-us-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,27 @@
1
+ require "nokogiri"
2
+ require "open-uri"
3
+
4
+ module Nx
5
+ class UsProxy
6
+ def self.fetch(proxy = "http://127.0.0.1:9090")
7
+ doc = Nokogiri::HTML(
8
+ open(
9
+ "https://www.us-proxy.org/",
10
+ read_timeout: 5,
11
+ proxy: proxy,
12
+ )
13
+ )
14
+
15
+ # process html use selector
16
+ rows = doc.css("#proxylisttable tbody tr")
17
+ data = []
18
+ rows.each do |row|
19
+ ip = row.css("td:nth-child(1)").text
20
+ port = row.css("td:nth-child(2)").text
21
+ data << { ip: ip, port: port }
22
+ end
23
+
24
+ return data
25
+ end
26
+ end
27
+ end
data/lib/nx/version.rb ADDED
@@ -0,0 +1,5 @@
1
+ module Nx
2
+ class UsProxy
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require "nx/version"
2
+ require "nx/us-proxy"
@@ -0,0 +1,36 @@
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-us-proxy"
8
+ spec.version = Nx::UsProxy::VERSION
9
+ spec.licenses = ["MIT"]
10
+ spec.authors = ["afeiship"]
11
+ spec.email = ["1290657123@qq.com"]
12
+
13
+ spec.summary = %q{Get us free proxies.}
14
+ spec.description = %q{Get us free proxies for ruby.}
15
+ spec.homepage = "https://github.com/afeiship/nx-us-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
+ spec.add_dependency "nokogiri", "~>1.10.7"
36
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nx-us-proxy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - afeiship
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-02-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.14'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: nokogiri
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.10.7
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.10.7
55
+ description: Get us free proxies for ruby.
56
+ email:
57
+ - 1290657123@qq.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - README.md
65
+ - Rakefile
66
+ - bin/console
67
+ - bin/setup
68
+ - lib/nx-us-proxy.rb
69
+ - lib/nx/us-proxy.rb
70
+ - lib/nx/version.rb
71
+ - nx-us-proxy.gemspec
72
+ homepage: https://github.com/afeiship/nx-us-proxy
73
+ licenses:
74
+ - MIT
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubygems_version: 3.1.2
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: Get us free proxies.
95
+ test_files: []