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: StringThe URL to extract from. Required.
user_prompt: StringPlain-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).
Whitelist of tags to keep before extraction.
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
impl SmartScraperRequest
Sourcepub fn new(
website_url: impl Into<String>,
user_prompt: impl Into<String>,
) -> Self
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.
Sourcepub fn output_schema(self, schema: Value) -> Self
pub fn output_schema(self, schema: Value) -> Self
Set the JSON Schema for the output.
Sourcepub fn page_complexity(self, complexity: PageComplexity) -> Self
pub fn page_complexity(self, complexity: PageComplexity) -> Self
Set the page-complexity hint.
Sourcepub fn detail_level(self, level: DetailLevel) -> Self
pub fn detail_level(self, level: DetailLevel) -> Self
Set the detail level.
Sourcepub fn parse_mode(self, mode: ParseMode) -> Self
pub fn parse_mode(self, mode: ParseMode) -> Self
Set the cleaner mode.
Sourcepub fn plain_text(self, plain_text: bool) -> Self
pub fn plain_text(self, plain_text: bool) -> Self
Return raw text instead of parsed JSON (bypasses schema validation).
Set the tag whitelist.
Set the tag blacklist.
Sourcepub fn reduce_content(self, reduce_content: bool) -> Self
pub fn reduce_content(self, reduce_content: bool) -> Self
Trim long content before extraction.
Sourcepub fn experimental(self, experimental: bool) -> Self
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.
Sourcepub fn header(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn header(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add a single custom request header.
Sourcepub fn headers(self, headers: HashMap<String, String>) -> Self
pub fn headers(self, headers: HashMap<String, String>) -> Self
Replace all custom request headers.
Trait Implementations§
Source§impl Clone for SmartScraperRequest
impl Clone for SmartScraperRequest
Source§fn clone(&self) -> SmartScraperRequest
fn clone(&self) -> SmartScraperRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more