Skip to main content

ScrapeConfig

Struct ScrapeConfig 

Source
pub struct ScrapeConfig {
Show 42 fields pub url: String, pub method: Option<HttpMethod>, pub body: Option<String>, pub headers: BTreeMap<String, String>, pub cookies: BTreeMap<String, String>, pub country: Option<String>, pub proxy_pool: Option<ProxyPool>, pub render_js: bool, pub asp: bool, pub cache: bool, pub cache_ttl: Option<u32>, pub cache_clear: bool, pub timeout: Option<u32>, pub cost_budget: Option<u32>, pub retry: Option<bool>, pub session: Option<String>, pub session_sticky_proxy: bool, pub tags: Vec<String>, pub webhook: Option<String>, pub debug: bool, pub ssl: bool, pub dns: bool, pub correlation_id: Option<String>, pub format: Option<Format>, pub format_options: Vec<FormatOption>, pub extraction_template: Option<String>, pub extraction_ephemeral_template: Option<Value>, pub extraction_prompt: Option<String>, pub extraction_model: Option<ExtractionModel>, pub wait_for_selector: Option<String>, pub rendering_wait: Option<u32>, pub auto_scroll: bool, pub screenshots: BTreeMap<String, String>, pub screenshot_flags: Vec<ScreenshotFlag>, pub js: Option<String>, pub js_scenario: Option<Value>, pub os: Option<String>, pub lang: Vec<String>, pub browser_brand: Option<String>, pub geolocation: Option<String>, pub rendering_stage: Option<String>, pub proxified_response: bool,
}
Expand description

Configuration for a single POST /scrape request.

Construct via ScrapeConfig::builder.

Fields§

§url: String

Target URL (required).

§method: Option<HttpMethod>

HTTP method; defaults to GET.

§body: Option<String>

Raw request body.

§headers: BTreeMap<String, String>

Request headers (sent as headers[key]=value).

§cookies: BTreeMap<String, String>

Cookies (merged into headers[cookie]).

§country: Option<String>

Proxy country.

§proxy_pool: Option<ProxyPool>

Proxy pool.

§render_js: bool

Enable JavaScript rendering.

§asp: bool

Enable Anti-Scraping Protection bypass.

§cache: bool

Enable cache.

§cache_ttl: Option<u32>

Cache TTL (seconds).

§cache_clear: bool

Force cache refresh.

§timeout: Option<u32>

Timeout in milliseconds.

§cost_budget: Option<u32>

Maximum API credit cost the caller is willing to spend on this request. If the server’s pre-flight estimate exceeds this budget the request is rejected before execution.

§retry: Option<bool>

Enable automatic retries.

§session: Option<String>

Session name.

§session_sticky_proxy: bool

Sticky-proxy inside the session.

§tags: Vec<String>

Custom tags.

§webhook: Option<String>

Webhook name.

§debug: bool

Debug mode.

§ssl: bool

Capture SSL details.

§dns: bool

Capture DNS details.

§correlation_id: Option<String>

Correlation ID.

§format: Option<Format>

Output format.

§format_options: Vec<FormatOption>

Format options.

§extraction_template: Option<String>

Saved extraction template name.

§extraction_ephemeral_template: Option<Value>

Inline (ephemeral) extraction template as JSON value.

§extraction_prompt: Option<String>

AI extraction prompt.

§extraction_model: Option<ExtractionModel>

Extraction model.

§wait_for_selector: Option<String>

Wait for CSS selector (requires render_js).

§rendering_wait: Option<u32>

Extra wait after page load, milliseconds.

§auto_scroll: bool

Auto-scroll to load lazy content.

§screenshots: BTreeMap<String, String>

Named screenshots (name → selector, or “fullpage”).

§screenshot_flags: Vec<ScreenshotFlag>

Screenshot flags.

§js: Option<String>

Inline JavaScript code (base64url-encoded on the wire).

§js_scenario: Option<Value>

JS scenario (serialized as JSON then base64url-encoded).

§os: Option<String>

OS fingerprint hint.

§lang: Vec<String>

Accept-Language values.

§browser_brand: Option<String>

Browser brand (chrome | edge | brave | opera).

§geolocation: Option<String>

Spoof browser geolocation. Format: "latitude,longitude".

§rendering_stage: Option<String>

Page load stage to wait for. complete (default) or domcontentloaded.

§proxified_response: bool

Return the raw upstream response instead of the JSON envelope. When true, callers must use Client::scrape_proxified() which returns reqwest::Response directly.

Implementations§

Source§

impl ScrapeConfig

Source

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

Start a builder for url.

Source

pub fn to_query_pairs(&self) -> Result<Vec<(String, String)>, ScrapflyError>

Serialize the config into the query-parameter pairs that the /scrape endpoint expects. Mirrors sdk/go/config_scrape.go::toAPIParamsWithValidation.

Trait Implementations§

Source§

impl Clone for ScrapeConfig

Source§

fn clone(&self) -> ScrapeConfig

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 ScrapeConfig

Source§

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

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

impl Default for ScrapeConfig

Source§

fn default() -> ScrapeConfig

Returns the “default value” for a type. 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.

Source§

impl<T> Instrument for T

Source§

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

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

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.

Source§

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

Source§

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
Source§

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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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

Source§

impl<T> MaybeSendSync for T