pub struct SpiderCloudConfig {
pub api_key: String,
pub mode: SpiderCloudMode,
pub api_url: String,
pub proxy_url: String,
pub return_format: SpiderCloudReturnFormat,
pub return_formats: Option<Vec<SpiderCloudReturnFormat>>,
pub extra_params: Option<HashMap<String, Value>>,
}spider_cloud only.Expand description
Configuration for spider.cloud integration.
Spider Cloud provides anti-bot bypass, proxy rotation, and high-throughput data collection. Sign up at https://spider.cloud to obtain an API key.
Fields§
§api_key: StringAPI key / secret. Sign up at https://spider.cloud to get one.
mode: SpiderCloudModeIntegration mode.
api_url: StringAPI base URL (default: https://api.spider.cloud).
proxy_url: StringProxy URL (default: https://proxy.spider.cloud).
return_format: SpiderCloudReturnFormatReturn format for API responses (default: SpiderCloudReturnFormat::Raw).
return_formats: Option<Vec<SpiderCloudReturnFormat>>Request multiple return formats in a single crawl.
When set, the API returns content as an object keyed by format
(e.g. {"markdown": "...", "raw": "..."}). The primary return_format
is stored in Page::get_content and
the extras are accessible via Page::get_content_for.
extra_params: Option<HashMap<String, Value>>Extra params forwarded in API mode (e.g. stealth, fingerprint, cache).
Implementations§
Source§impl SpiderCloudConfig
impl SpiderCloudConfig
Sourcepub fn with_mode(self, mode: SpiderCloudMode) -> Self
pub fn with_mode(self, mode: SpiderCloudMode) -> Self
Set the integration mode.
Sourcepub fn with_api_url(self, url: impl Into<String>) -> Self
pub fn with_api_url(self, url: impl Into<String>) -> Self
Set a custom API base URL.
Sourcepub fn with_proxy_url(self, url: impl Into<String>) -> Self
pub fn with_proxy_url(self, url: impl Into<String>) -> Self
Set a custom proxy URL.
Sourcepub fn with_return_format(self, fmt: impl Into<SpiderCloudReturnFormat>) -> Self
pub fn with_return_format(self, fmt: impl Into<SpiderCloudReturnFormat>) -> Self
Set the return format for API responses.
Accepts SpiderCloudReturnFormat directly or a string like "markdown":
config.with_return_format(SpiderCloudReturnFormat::Markdown)
config.with_return_format("markdown")Sourcepub fn with_return_formats(self, formats: Vec<SpiderCloudReturnFormat>) -> Self
pub fn with_return_formats(self, formats: Vec<SpiderCloudReturnFormat>) -> Self
Request multiple return formats in a single crawl.
The first format becomes the primary content (accessible via
Page::get_content), and all formats are
accessible via Page::get_content_for.
config.with_return_formats(vec![
SpiderCloudReturnFormat::Markdown,
SpiderCloudReturnFormat::Raw,
])Sourcepub fn has_multiple_formats(&self) -> bool
pub fn has_multiple_formats(&self) -> bool
Check if multiple return formats are requested.
Sourcepub fn with_extra_params(self, params: HashMap<String, Value>) -> Self
pub fn with_extra_params(self, params: HashMap<String, Value>) -> Self
Set extra params for API mode.
Sourcepub fn should_fallback(&self, status_code: u16, body: Option<&[u8]>) -> bool
pub fn should_fallback(&self, status_code: u16, body: Option<&[u8]>) -> bool
Determine if a response should trigger a spider.cloud API fallback.
This encapsulates the intelligence about which status codes and content patterns indicate the page needs spider.cloud’s help.
Checks for:
- HTTP 403 (Forbidden) — typically bot protection
- HTTP 429 (Too Many Requests) — rate limiting
- HTTP 503 (Service Unavailable) — often Cloudflare/DDoS protection
- HTTP 520-530 (Cloudflare error range)
- HTTP 5xx (server errors)
- Empty body on what should be an HTML page
- Known CAPTCHA / challenge page markers in the response body
Sourcepub fn fallback_route(&self) -> &'static str
pub fn fallback_route(&self) -> &'static str
Get the fallback API route for this config.
Smartmode →/unblocker(best for bot-protected pages)Fallbackmode →/crawl(general purpose)- Other modes →
/crawl(default)
Sourcepub fn uses_proxy(&self) -> bool
pub fn uses_proxy(&self) -> bool
Whether this mode uses the proxy transport layer.
Trait Implementations§
Source§impl Clone for SpiderCloudConfig
impl Clone for SpiderCloudConfig
Source§fn clone(&self) -> SpiderCloudConfig
fn clone(&self) -> SpiderCloudConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SpiderCloudConfig
impl Debug for SpiderCloudConfig
Source§impl Default for SpiderCloudConfig
impl Default for SpiderCloudConfig
Source§impl<'de> Deserialize<'de> for SpiderCloudConfig
impl<'de> Deserialize<'de> for SpiderCloudConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for SpiderCloudConfig
impl PartialEq for SpiderCloudConfig
Source§impl Serialize for SpiderCloudConfig
impl Serialize for SpiderCloudConfig
impl Eq for SpiderCloudConfig
impl StructuralPartialEq for SpiderCloudConfig
Auto Trait Implementations§
impl Freeze for SpiderCloudConfig
impl RefUnwindSafe for SpiderCloudConfig
impl Send for SpiderCloudConfig
impl Sync for SpiderCloudConfig
impl Unpin for SpiderCloudConfig
impl UnsafeUnpin for SpiderCloudConfig
impl UnwindSafe for SpiderCloudConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more