Skip to main content

ScrapeConfigBuilder

Struct ScrapeConfigBuilder 

Source
pub struct ScrapeConfigBuilder { /* private fields */ }
Expand description

Builder for ScrapeConfig.

Implementations§

Source§

impl ScrapeConfigBuilder

Source

pub fn method(self, m: HttpMethod) -> Self

Set HTTP method.

Source

pub fn body(self, b: impl Into<String>) -> Self

Set raw request body.

Source

pub fn header(self, k: impl Into<String>, v: impl Into<String>) -> Self

Set a custom header.

Source

pub fn headers(self, headers: BTreeMap<String, String>) -> Self

Replace the full header map.

Source

pub fn cookie(self, k: impl Into<String>, v: impl Into<String>) -> Self

Set a cookie.

Source

pub fn country(self, c: impl Into<String>) -> Self

Set proxy country.

Source

pub fn proxy_pool(self, p: ProxyPool) -> Self

Set proxy pool.

Source

pub fn render_js(self, v: bool) -> Self

Enable JS rendering.

Source

pub fn asp(self, v: bool) -> Self

Enable ASP bypass.

Source

pub fn cache(self, v: bool) -> Self

Enable cache.

Source

pub fn cache_ttl(self, v: u32) -> Self

Set cache TTL.

Source

pub fn cache_clear(self, v: bool) -> Self

Force cache refresh.

Source

pub fn cost_budget(self, v: u32) -> Self

Set the maximum API credit cost the caller will accept for this request. The server rejects the request pre-flight if its estimate exceeds the budget, so callers get a fast failure instead of a surprise bill.

Source

pub fn timeout(self, v: u32) -> Self

Set request timeout (ms).

Source

pub fn retry(self, v: bool) -> Self

Set automatic retry flag.

Source

pub fn session(self, v: impl Into<String>) -> Self

Set session name.

Source

pub fn session_sticky_proxy(self, v: bool) -> Self

Sticky proxy in a session.

Source

pub fn tag(self, v: impl Into<String>) -> Self

Add a tag.

Source

pub fn tags(self, v: Vec<String>) -> Self

Set all tags.

Source

pub fn webhook(self, v: impl Into<String>) -> Self

Set webhook name.

Source

pub fn debug(self, v: bool) -> Self

Enable debug mode.

Source

pub fn ssl(self, v: bool) -> Self

Capture SSL details.

Source

pub fn dns(self, v: bool) -> Self

Capture DNS details.

Source

pub fn correlation_id(self, v: impl Into<String>) -> Self

Set correlation ID.

Source

pub fn format(self, v: Format) -> Self

Set output format.

Source

pub fn format_option(self, v: FormatOption) -> Self

Add a format option.

Source

pub fn extraction_template(self, v: impl Into<String>) -> Self

Set saved extraction template name.

Source

pub fn extraction_ephemeral_template(self, v: Value) -> Self

Set inline extraction template.

Source

pub fn extraction_prompt(self, v: impl Into<String>) -> Self

Set AI extraction prompt.

Source

pub fn extraction_model(self, v: ExtractionModel) -> Self

Set extraction model.

Source

pub fn wait_for_selector(self, v: impl Into<String>) -> Self

Set wait-for-selector.

Source

pub fn rendering_wait(self, v: u32) -> Self

Set extra rendering wait (ms).

Source

pub fn auto_scroll(self, v: bool) -> Self

Enable auto-scroll.

Source

pub fn screenshot( self, name: impl Into<String>, selector: impl Into<String>, ) -> Self

Add a named screenshot.

Source

pub fn screenshot_flag(self, v: ScreenshotFlag) -> Self

Add a screenshot flag.

Source

pub fn js(self, v: impl Into<String>) -> Self

Set inline JS code.

Source

pub fn js_scenario(self, v: Value) -> Self

Set JS scenario (as serde_json::Value).

Source

pub fn os(self, v: impl Into<String>) -> Self

Set OS fingerprint hint.

Source

pub fn lang(self, v: impl Into<String>) -> Self

Add an Accept-Language value.

Source

pub fn browser_brand(self, v: impl Into<String>) -> Self

Set browser brand.

Source

pub fn geolocation(self, v: impl Into<String>) -> Self

Enable proxified response mode (raw upstream pass-through). Spoof browser geolocation. Format: "latitude,longitude".

Source

pub fn rendering_stage(self, v: impl Into<String>) -> Self

Set page load stage: "complete" (default) or "domcontentloaded".

Source

pub fn proxified_response(self) -> Self

Enable proxified response mode (raw upstream pass-through).

Source

pub fn build(self) -> Result<ScrapeConfig, ScrapflyError>

Finalize the builder, enforcing the mutual-exclusion rules for the extraction fields.

Trait Implementations§

Source§

impl Clone for ScrapeConfigBuilder

Source§

fn clone(&self) -> ScrapeConfigBuilder

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 ScrapeConfigBuilder

Source§

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

Formats the value using the given formatter. 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> Same for T

Source§

type Output = T

Should always be Self
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