pub struct Client(/* private fields */);Expand description
Async webscrape.ai API client. Cheap to Clone (reference-counted).
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(api_key: impl Into<String>) -> Result<Self>
pub fn new(api_key: impl Into<String>) -> Result<Self>
Construct a client with an explicit API key and otherwise default config.
Returns Error::Config if api_key is empty.
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Construct a client reading the API key from the WEBSCRAPE_API_KEY
environment variable.
Returns Error::Config if the variable is unset or empty.
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Start a ClientBuilder for custom configuration.
Sourcepub async fn scrape(
&self,
request: ScrapeRequest,
) -> Result<Response<ScrapeData>>
pub async fn scrape( &self, request: ScrapeRequest, ) -> Result<Response<ScrapeData>>
Fetch a URL as HTML, cleaned markdown, or links. Costs 1 credit (+2 with stealth).
Sourcepub async fn smartscraper(
&self,
request: SmartScraperRequest,
) -> Result<Response<SmartScraperData>>
pub async fn smartscraper( &self, request: SmartScraperRequest, ) -> Result<Response<SmartScraperData>>
LLM structured extraction returning JSON. Costs 5 credits (+5 with stealth).
Sourcepub fn smartbrowse(&self) -> SmartBrowse<'_>
pub fn smartbrowse(&self) -> SmartBrowse<'_>
Access the SmartBrowse namespace (run recipes, poll runs, usage).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
impl Freeze for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more