Skip to main content

SmartScraperRequest

Struct SmartScraperRequest 

Source
pub struct SmartScraperRequest {
Show 14 fields pub website_url: String, pub user_prompt: String, pub output_schema: Option<Value>, pub page_complexity: Option<PageComplexity>, pub detail_level: Option<DetailLevel>, pub parse_mode: Option<ParseMode>, pub plain_text: Option<bool>, pub include_tags: Option<Vec<String>>, pub exclude_tags: Option<Vec<String>>, pub reduce_content: Option<bool>, pub experimental: Option<bool>, pub headers: Option<HashMap<String, String>>, pub max_age: Option<u64>, pub stealth: Option<bool>,
}
Expand description

Request body for Client::smartscraper.

Build with SmartScraperRequest::new; only fields you touch are serialized.

Fields§

§website_url: String

The URL to extract from. Required.

§user_prompt: String

Plain-English description of what to extract. Required. (Wire field name is user_prompt, not prompt.)

§output_schema: Option<Value>

JSON Schema the result is validated against (one repair attempt).

§page_complexity: Option<PageComplexity>

Page-complexity hint.

§detail_level: Option<DetailLevel>

How exhaustively to populate the result.

§parse_mode: Option<ParseMode>

Cleaner mode.

§plain_text: Option<bool>

Return raw text under result (bypasses schema validation).

§include_tags: Option<Vec<String>>

Whitelist of tags to keep before extraction.

§exclude_tags: Option<Vec<String>>

Blacklist of tags to drop before extraction.

§reduce_content: Option<bool>

Trim long content before extraction (tri-state; server default when unset).

§experimental: Option<bool>

Opt in to an alternate extraction path that can do better on hard-to-parse pages. Behavior may change without notice.

§headers: Option<HashMap<String, String>>

Custom request headers forwarded to the fetcher. Providing headers disables URL caching for this request.

§max_age: Option<u64>

URL-cache opt-in in seconds (same semantics as /scrape).

§stealth: Option<bool>

Browser-based stealth fetch. +5 credits.

Implementations§

Source§

impl SmartScraperRequest

Source

pub fn new( website_url: impl Into<String>, user_prompt: impl Into<String>, ) -> Self

Start a request for website_url with the given user_prompt.

Source

pub fn output_schema(self, schema: Value) -> Self

Set the JSON Schema for the output.

Source

pub fn page_complexity(self, complexity: PageComplexity) -> Self

Set the page-complexity hint.

Source

pub fn detail_level(self, level: DetailLevel) -> Self

Set the detail level.

Source

pub fn parse_mode(self, mode: ParseMode) -> Self

Set the cleaner mode.

Source

pub fn plain_text(self, plain_text: bool) -> Self

Return raw text instead of parsed JSON (bypasses schema validation).

Source

pub fn include_tags<I, S>(self, tags: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Set the tag whitelist.

Source

pub fn exclude_tags<I, S>(self, tags: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Set the tag blacklist.

Source

pub fn reduce_content(self, reduce_content: bool) -> Self

Trim long content before extraction.

Source

pub fn experimental(self, experimental: bool) -> Self

Opt in to an alternate extraction path that can do better on hard-to-parse pages. Behavior may change without notice.

Source

pub fn header(self, key: impl Into<String>, value: impl Into<String>) -> Self

Add a single custom request header.

Source

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

Replace all custom request headers.

Source

pub fn max_age(self, seconds: u64) -> Self

Opt into URL caching: accept cache entries fresher than seconds.

Source

pub fn stealth(self, stealth: bool) -> Self

Use browser-based stealth fetch (+5 credits).

Trait Implementations§

Source§

impl Clone for SmartScraperRequest

Source§

fn clone(&self) -> SmartScraperRequest

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SmartScraperRequest

Source§

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

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

impl Default for SmartScraperRequest

Source§

fn default() -> SmartScraperRequest

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

impl Serialize for SmartScraperRequest

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.

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: Sized + 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: Sized + 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