Skip to main content

CrawlerConfig

Struct CrawlerConfig 

Source
pub struct CrawlerConfig {
Show 30 fields pub url: 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.

Every field except url is optional; unset fields are NOT serialized so the server applies its own documented defaults.

Fields§

§url: String

Seed URL (required, must be HTTP/HTTPS).

§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: bool

Ignore the seed URL’s base-path restriction.

§follow_external_links: bool

Follow 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: bool

Honor sitemaps.

§ignore_no_follow: bool

Follow nofollow links anyway.

§respect_robots_txt: Option<bool>

Tri-state: None = server default (true).

§cache: bool

Enable cache.

§cache_ttl: Option<u32>

Cache TTL seconds (0..=604800).

§cache_clear: bool

Force cache refresh.

§content_formats: Vec<CrawlerContentFormat>

Desired content formats.

§extraction_rules: Option<Value>

Inline extraction rules.

§asp: bool

Enable 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

Source

pub fn builder(url: impl Into<String>) -> CrawlerConfigBuilder

Start a builder for url.

Source

pub fn validate(&self) -> Result<(), ScrapflyError>

Validate numeric bounds + list sizes. Ported from sdk/go/config_crawler.go::validateBounds.

Source

pub fn to_json_body(&self) -> Result<Vec<u8>, ScrapflyError>

Serialize into the JSON body the crawler endpoint expects.

Trait Implementations§

Source§

impl Clone for CrawlerConfig

Source§

fn clone(&self) -> CrawlerConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CrawlerConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CrawlerConfig

Source§

fn default() -> CrawlerConfig

Returns the “default value” for a type. Read more
Source§

impl Serialize for CrawlerConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T