pub struct FreeApiProxiesFetcher { /* private fields */ }Expand description
Fetches proxies from a JSON API compatible with FreeAPIProxies-style payloads.
The adapter accepts either a top-level array payload or an object payload
with data or results arrays. Optional query parameters (limit,
protocol, country) are appended to the endpoint URL when set.
§Example
use stygian_proxy::fetcher::{FreeApiProxiesFetcher, ProxyFetcher};
let fetcher = FreeApiProxiesFetcher::new()
.with_limit(100)
.with_protocol_filter("http")
.with_country_filter("US");
let proxies = fetcher.fetch().await?;
println!("Got {} proxies", proxies.len());Implementations§
Source§impl FreeApiProxiesFetcher
impl FreeApiProxiesFetcher
Sourcepub fn with_endpoint(endpoint: impl Into<String>) -> Self
pub fn with_endpoint(endpoint: impl Into<String>) -> Self
Create a FreeAPIProxies fetcher using a custom JSON endpoint.
Attach extra tags to every proxy produced by this fetcher.
Sourcepub const fn with_limit(self, limit: u32) -> Self
pub const fn with_limit(self, limit: u32) -> Self
Set the maximum number of proxies to request from the API.
Appended to the request as ?limit=<n>. Ignored when None.
§Example
use stygian_proxy::fetcher::FreeApiProxiesFetcher;
let _f = FreeApiProxiesFetcher::new().with_limit(50);Sourcepub fn with_protocol_filter(self, protocol: impl Into<String>) -> Self
pub fn with_protocol_filter(self, protocol: impl Into<String>) -> Self
Filter by proxy protocol on the server side.
Appended to the request as ?protocol=<value>. Common values are
"http", "https", "socks4", and "socks5".
§Example
use stygian_proxy::fetcher::FreeApiProxiesFetcher;
let _f = FreeApiProxiesFetcher::new().with_protocol_filter("http");Sourcepub fn with_country_filter(self, country_code: impl Into<String>) -> Self
pub fn with_country_filter(self, country_code: impl Into<String>) -> Self
Filter by ISO 3166-1 alpha-2 country code on the server side.
Appended to the request as ?country=<value> (uppercased).
§Example
use stygian_proxy::fetcher::FreeApiProxiesFetcher;
let _f = FreeApiProxiesFetcher::new().with_country_filter("US");