pub struct CrawlerConfig {Show 32 fields
pub url: String,
pub url_list: Vec<String>,
pub remote_url_list: String,
pub page_limit: Option<u32>,
pub max_depth: Option<u32>,
pub max_duration: Option<u32>,
pub max_api_credit: Option<u32>,
pub exclude_paths: Vec<String>,
pub include_only_paths: Vec<String>,
pub ignore_base_path_restriction: bool,
pub follow_external_links: bool,
pub allowed_external_domains: Vec<String>,
pub follow_internal_subdomains: Option<bool>,
pub allowed_internal_subdomains: Vec<String>,
pub headers: BTreeMap<String, String>,
pub delay: Option<u32>,
pub user_agent: Option<String>,
pub max_concurrency: Option<u32>,
pub rendering_delay: Option<u32>,
pub use_sitemaps: bool,
pub ignore_no_follow: bool,
pub respect_robots_txt: Option<bool>,
pub cache: bool,
pub cache_ttl: Option<u32>,
pub cache_clear: bool,
pub content_formats: Vec<CrawlerContentFormat>,
pub extraction_rules: Option<Value>,
pub asp: bool,
pub proxy_pool: Option<String>,
pub country: Option<String>,
pub webhook_name: Option<String>,
pub webhook_events: Vec<CrawlerWebhookEvent>,
}Expand description
Configuration for a POST /crawl request.
Exactly one URL source must be provided: url (seed crawl with
discovery), url_list (in-memory list, no discovery), or
remote_url_list (URL of a hosted text file fetched at crawl start, no
discovery). Other fields default to server-side values when zero.
Fields§
§url: StringSeed URL (must be HTTP/HTTPS). Mutually exclusive with url_list
and remote_url_list.
url_list: Vec<String>Explicit URL list (no discovery). Mutually exclusive with url
and remote_url_list. When set, the SDK posts the request as
multipart/form-data so the URLs are uploaded as a streamed file
payload rather than inlined into the JSON body.
remote_url_list: StringURL of a hosted text file (one URL per line) fetched at crawl
start. Mutually exclusive with url and url_list.
page_limit: Option<u32>Max pages to crawl.
max_depth: Option<u32>Max link-follow depth.
max_duration: Option<u32>Max duration (seconds, 15..=10800).
max_api_credit: Option<u32>Max API credit to spend (0 = no limit).
exclude_paths: Vec<String>Exclude these URL paths (≤100 entries).
include_only_paths: Vec<String>Restrict crawl to these paths (≤100 entries).
ignore_base_path_restriction: boolIgnore the seed URL’s base-path restriction.
follow_external_links: boolFollow links to external domains.
allowed_external_domains: Vec<String>Whitelist of external domains (≤250 entries).
follow_internal_subdomains: Option<bool>Tri-state: None = unset (server default true), Some(v) = explicit.
allowed_internal_subdomains: Vec<String>Whitelist of internal subdomains (≤250 entries).
headers: BTreeMap<String, String>Request headers sent for every crawled page.
delay: Option<u32>Delay between requests (ms, 0..=15000).
user_agent: Option<String>Override User-Agent.
max_concurrency: Option<u32>Max concurrent workers.
rendering_delay: Option<u32>Rendering delay (ms, 0..=25000).
use_sitemaps: boolHonor sitemaps.
ignore_no_follow: boolFollow nofollow links anyway.
respect_robots_txt: Option<bool>Tri-state: None = server default (true).
cache: boolEnable cache.
cache_ttl: Option<u32>Cache TTL seconds (0..=604800).
cache_clear: boolForce cache refresh.
content_formats: Vec<CrawlerContentFormat>Desired content formats.
extraction_rules: Option<Value>Inline extraction rules.
asp: boolEnable ASP bypass.
proxy_pool: Option<String>Proxy pool name.
country: Option<String>Proxy country.
webhook_name: Option<String>Webhook name.
webhook_events: Vec<CrawlerWebhookEvent>Webhook events.
Implementations§
Source§impl CrawlerConfig
impl CrawlerConfig
Sourcepub fn builder(url: impl Into<String>) -> CrawlerConfigBuilder
pub fn builder(url: impl Into<String>) -> CrawlerConfigBuilder
Start a builder for url (seed-URL crawl with discovery).
Sourcepub fn builder_url_list(
urls: impl IntoIterator<Item = impl Into<String>>,
) -> CrawlerConfigBuilder
pub fn builder_url_list( urls: impl IntoIterator<Item = impl Into<String>>, ) -> CrawlerConfigBuilder
Start a builder for an explicit url_list (no discovery). The SDK
will post this configuration as multipart/form-data so the URLs are
uploaded as a streamed file payload.
Sourcepub fn builder_remote_url_list(url: impl Into<String>) -> CrawlerConfigBuilder
pub fn builder_remote_url_list(url: impl Into<String>) -> CrawlerConfigBuilder
Start a builder for remote_url_list (no discovery, list fetched
from the given URL at crawl start).
Sourcepub fn validate(&self) -> Result<(), ScrapflyError>
pub fn validate(&self) -> Result<(), ScrapflyError>
Validate numeric bounds + list sizes. Ported from
sdk/go/config_crawler.go::validateBounds.
Sourcepub fn to_json_body(&self) -> Result<Vec<u8>, ScrapflyError>
pub fn to_json_body(&self) -> Result<Vec<u8>, ScrapflyError>
Serialize into the JSON body the crawler endpoint expects. Used
for seed-URL crawls and remote_url_list crawls. For in-memory URL
lists the SDK switches to multipart (see to_multipart_body).
Sourcepub fn to_multipart_body(&self) -> Result<(Vec<u8>, String), ScrapflyError>
pub fn to_multipart_body(&self) -> Result<(Vec<u8>, String), ScrapflyError>
Build a multipart/form-data body for POST /crawl when an in-memory
url_list is supplied. The config part carries the JSON config
(without url_list) and the urls part carries the URLs as
text/plain, one per line. Returns the body bytes and the matching
Content-Type header (with the boundary baked in).
Trait Implementations§
Source§impl Clone for CrawlerConfig
impl Clone for CrawlerConfig
Source§fn clone(&self) -> CrawlerConfig
fn clone(&self) -> CrawlerConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more