pub struct Scraper { /* private fields */ }Implementations§
Source§impl Scraper
impl Scraper
pub fn new(config: ScraperConfig) -> Result<Self, ScraperError>
Sourcepub async fn probe_browsers(&self)
pub async fn probe_browsers(&self)
服务启动时在后台把每个内核启动一次,确认哪些能用(日志里写明),能用的浏览器留着备用。
pub async fn shutdown(&self)
pub async fn scrape( &self, url: &str, opts: &ScrapeOptions, ) -> Result<Document, ApiError>
pub fn network_stage_snapshots(&self) -> Vec<StageSnapshot>
pub fn transport_phase_snapshots(&self) -> Vec<PhaseSnapshot>
Sourcepub fn concurrency(&self) -> usize
pub fn concurrency(&self) -> usize
Returns current active concurrency limit.
Sourcepub fn set_concurrency(&self, target: usize)
pub fn set_concurrency(&self, target: usize)
Dynamically adjusts the global crawl concurrency limit at runtime.
Trait Implementations§
Source§impl Engine for Scraper
impl Engine for Scraper
fn scrape<'a>( &'a self, url: &'a str, opts: &'a ScrapeOptions, ) -> BoxFuture<'a, Result<Document, ApiError>>
Source§fn parse<'a>(
&'a self,
file: Upload,
opts: &'a ScrapeOptions,
) -> BoxFuture<'a, Result<Document, ApiError>>
fn parse<'a>( &'a self, file: Upload, opts: &'a ScrapeOptions, ) -> BoxFuture<'a, Result<Document, ApiError>>
fn map<'a>( &'a self, req: &'a MapRequest, ) -> BoxFuture<'a, Result<Vec<MapLink>, ApiError>>
Source§fn crawl<'a>(
&'a self,
req: &'a CrawlRequest,
sink: Arc<dyn CrawlSink>,
) -> BoxFuture<'a, Result<(), ApiError>>
fn crawl<'a>( &'a self, req: &'a CrawlRequest, sink: Arc<dyn CrawlSink>, ) -> BoxFuture<'a, Result<(), ApiError>>
整站爬取:抓到一页、出错一页、发现新 URL 时都通过
sink 回报,直到爬完或被取消。Source§fn search<'a>(
&'a self,
req: &'a SearchRequest,
) -> BoxFuture<'a, Result<Value, ApiError>>
fn search<'a>( &'a self, req: &'a SearchRequest, ) -> BoxFuture<'a, Result<Value, ApiError>>
/v2/search:返回 Firecrawl 的 data({ "web": [...] })。Source§fn extract<'a>(
&'a self,
req: &'a ExtractRequest,
) -> BoxFuture<'a, Result<Value, ApiError>>
fn extract<'a>( &'a self, req: &'a ExtractRequest, ) -> BoxFuture<'a, Result<Value, ApiError>>
/v2/extract:返回提取出的 JSON。Source§fn supported_formats(&self) -> &'static [&'static str]
fn supported_formats(&self) -> &'static [&'static str]
引擎支持的
formats;请求了不支持的格式时返回 UNSUPPORTED_OPTION,不悄悄忽略。Source§fn supports_actions(&self) -> bool
fn supports_actions(&self) -> bool
是否支持
actions(需要浏览器渲染)。Auto Trait Implementations§
impl !Freeze for Scraper
impl !RefUnwindSafe for Scraper
impl !UnwindSafe for Scraper
impl Send for Scraper
impl Sync for Scraper
impl Unpin for Scraper
impl UnsafeUnpin for Scraper
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