From da6baec5750f883899e2862bd8814db7693eee56 Mon Sep 17 00:00:00 2001 From: Nikita Bulai Date: Fri, 2 Jun 2023 10:29:33 +0300 Subject: [PATCH] Remove dead providers, bump to 0.17 --- CHANGELOG.md | 9 +++ lib/proxy_fetcher.rb | 3 - .../providers/proxyscrape_http.rb | 65 ------------------- .../providers/proxyscrape_socks4.rb | 65 ------------------- .../providers/proxyscrape_socks5.rb | 65 ------------------- lib/proxy_fetcher/version.rb | 2 +- .../providers/proxy_classes_spec.rb | 3 - 7 files changed, 10 insertions(+), 202 deletions(-) delete mode 100644 lib/proxy_fetcher/providers/proxyscrape_http.rb delete mode 100644 lib/proxy_fetcher/providers/proxyscrape_socks4.rb delete mode 100644 lib/proxy_fetcher/providers/proxyscrape_socks5.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a90096..a9d9617 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,15 @@ Reverse Chronological Order: ... +## `0.17.0` (2023-06-02) + +* Remove dead providers + +## `0.16.0` (2022-02-04) + +* Fix providers +* Improve HTTP.rb dependency + ## `0.15.1` (2021-02-17) * Support for Ruby 3.0 diff --git a/lib/proxy_fetcher.rb b/lib/proxy_fetcher.rb index 177cc93..132a043 100644 --- a/lib/proxy_fetcher.rb +++ b/lib/proxy_fetcher.rb @@ -41,9 +41,6 @@ module Providers require "#{File.dirname(__FILE__)}/proxy_fetcher/providers/mtpro" require "#{File.dirname(__FILE__)}/proxy_fetcher/providers/proxy_list" require "#{File.dirname(__FILE__)}/proxy_fetcher/providers/proxypedia" - require "#{File.dirname(__FILE__)}/proxy_fetcher/providers/proxyscrape_http" - require "#{File.dirname(__FILE__)}/proxy_fetcher/providers/proxyscrape_socks4" - require "#{File.dirname(__FILE__)}/proxy_fetcher/providers/proxyscrape_socks5" require "#{File.dirname(__FILE__)}/proxy_fetcher/providers/xroxy" end diff --git a/lib/proxy_fetcher/providers/proxyscrape_http.rb b/lib/proxy_fetcher/providers/proxyscrape_http.rb deleted file mode 100644 index 5bfd89f..0000000 --- a/lib/proxy_fetcher/providers/proxyscrape_http.rb +++ /dev/null @@ -1,65 +0,0 @@ -# frozen_string_literal: true - -require "csv" - -module ProxyFetcher - module Providers - # FreeProxyList provider class. - class ProxyscrapeHTTP < Base - # Provider URL to fetch proxy list - def provider_url - "https://api.proxyscrape.com/v2/?request=getproxies&protocol=http" - end - - # Loads provider HTML and parses it with internal document object. - # - # @param url [String] - # URL to fetch - # - # @param filters [Hash] - # filters for proxy provider - # - # @return [Array] - # Collection of extracted proxies with ports - # - def load_document(url, filters = {}) - html = load_html(url, filters) - - CSV.parse(html, col_sep: "\t").map(&:first) - end - - # Fetches HTML content by sending HTTP request to the provider URL and - # parses the txt document to return all the proxy entries (ip addresses - # and ports). - # - # @return [Array] - # Collection of extracted proxies with ports - # - def load_proxy_list(filters = {}) - load_document(provider_url, filters) - end - - # Converts String to ProxyFetcher::Proxy object. - # - # @param node [String] - # String - # - # @return [ProxyFetcher::Proxy] - # Proxy object - # - def to_proxy(node) - addr, port = node.split(":") - - ProxyFetcher::Proxy.new.tap do |proxy| - proxy.addr = addr - proxy.port = Integer(port) - proxy.country = "Unknown" - proxy.anonymity = "Unknown" - proxy.type = ProxyFetcher::Proxy::HTTP - end - end - end - - ProxyFetcher::Configuration.register_provider(:proxyscrape_http, ProxyscrapeHTTP) - end -end diff --git a/lib/proxy_fetcher/providers/proxyscrape_socks4.rb b/lib/proxy_fetcher/providers/proxyscrape_socks4.rb deleted file mode 100644 index d92e093..0000000 --- a/lib/proxy_fetcher/providers/proxyscrape_socks4.rb +++ /dev/null @@ -1,65 +0,0 @@ -# frozen_string_literal: true - -require "csv" - -module ProxyFetcher - module Providers - # FreeProxyList provider class. - class ProxyscrapeSOCKS4 < Base - # Provider URL to fetch proxy list - def provider_url - "https://api.proxyscrape.com/v2/?request=getproxies&protocol=socks4" - end - - # Loads provider HTML and parses it with internal document object. - # - # @param url [String] - # URL to fetch - # - # @param filters [Hash] - # filters for proxy provider - # - # @return [Array] - # Collection of extracted proxies with ports - # - def load_document(url, filters = {}) - html = load_html(url, filters) - - CSV.parse(html, col_sep: "\t").map(&:first) - end - - # Fetches HTML content by sending HTTP request to the provider URL and - # parses the txt document to return all the proxy entries (ip addresses - # and ports). - # - # @return [Array] - # Collection of extracted proxies with ports - # - def load_proxy_list(filters = {}) - load_document(provider_url, filters) - end - - # Converts String to ProxyFetcher::Proxy object. - # - # @param node [String] - # String - # - # @return [ProxyFetcher::Proxy] - # Proxy object - # - def to_proxy(html_node) - addr, port = html_node.split(":") - - ProxyFetcher::Proxy.new.tap do |proxy| - proxy.addr = addr - proxy.port = Integer(port) - proxy.country = "Unknown" - proxy.anonymity = "Unknown" - proxy.type = ProxyFetcher::Proxy::SOCKS4 - end - end - end - - ProxyFetcher::Configuration.register_provider(:proxyscrape_socks4, ProxyscrapeSOCKS4) - end -end diff --git a/lib/proxy_fetcher/providers/proxyscrape_socks5.rb b/lib/proxy_fetcher/providers/proxyscrape_socks5.rb deleted file mode 100644 index f2e63c6..0000000 --- a/lib/proxy_fetcher/providers/proxyscrape_socks5.rb +++ /dev/null @@ -1,65 +0,0 @@ -# frozen_string_literal: true - -require "csv" - -module ProxyFetcher - module Providers - # FreeProxyList provider class. - class ProxyscrapeSOCKS5 < Base - # Provider URL to fetch proxy list - def provider_url - "https://api.proxyscrape.com/v2/?request=getproxies&protocol=socks5" - end - - # Loads provider HTML and parses it with internal document object. - # - # @param url [String] - # URL to fetch - # - # @param filters [Hash] - # filters for proxy provider - # - # @return [Array] - # Collection of extracted proxies with ports - # - def load_document(url, filters = {}) - html = load_html(url, filters) - - CSV.parse(html, col_sep: "\t").map(&:first) - end - - # Fetches HTML content by sending HTTP request to the provider URL and - # parses the txt document to return all the proxy entries (ip addresses - # and ports). - # - # @return [Array] - # Collection of extracted proxies with ports - # - def load_proxy_list(filters = {}) - load_document(provider_url, filters) - end - - # Converts String to ProxyFetcher::Proxy object. - # - # @param node [String] - # String - # - # @return [ProxyFetcher::Proxy] - # Proxy object - # - def to_proxy(html_node) - addr, port = html_node.split(":") - - ProxyFetcher::Proxy.new.tap do |proxy| - proxy.addr = addr - proxy.port = Integer(port) - proxy.country = "Unknown" - proxy.anonymity = "Unknown" - proxy.type = ProxyFetcher::Proxy::SOCKS5 - end - end - end - - ProxyFetcher::Configuration.register_provider(:proxyscrape_socks5, ProxyscrapeSOCKS5) - end -end diff --git a/lib/proxy_fetcher/version.rb b/lib/proxy_fetcher/version.rb index 381cfea..0a0547c 100644 --- a/lib/proxy_fetcher/version.rb +++ b/lib/proxy_fetcher/version.rb @@ -13,7 +13,7 @@ module VERSION # Major version number MAJOR = 0 # Minor version number - MINOR = 16 + MINOR = 17 # Smallest version number TINY = 0 diff --git a/spec/proxy_fetcher/providers/proxy_classes_spec.rb b/spec/proxy_fetcher/providers/proxy_classes_spec.rb index c205274..d51a047 100644 --- a/spec/proxy_fetcher/providers/proxy_classes_spec.rb +++ b/spec/proxy_fetcher/providers/proxy_classes_spec.rb @@ -12,9 +12,6 @@ [:mtpro, "MTPro"], [:proxy_list, "ProxyList"], [:proxypedia, "Proxypedia"], - [:proxyscrape_http, "ProxyscrapeHTTP"], - [:proxyscrape_socks4, "ProxyscrapeSOCKS4"], - [:proxyscrape_socks5, "ProxyscrapeSOCKS5"], [:xroxy, "XRoxy"] ].each do |(provider_name, provider_klass)| describe Object.const_get("ProxyFetcher::Providers::#{provider_klass}") do