Skip to main content

Module fetcher

Module fetcher 

Source
Expand description

High-level browser session types that drive page fetching.

This is the main module most users interact with. It provides two session types:

  • DynamicSession – a standard browser automation session. It launches (or connects to) a Chromium instance, navigates to URLs, waits for the page to stabilise, and returns a scrapling_fetch::Response containing the rendered HTML, status code, headers, and cookies. Use this for sites that render content with JavaScript but do not actively block bots.

  • StealthySession – an anti-detection session that wraps DynamicSession behaviour with stealth Chromium flags, optional WebRTC/canvas/WebGL countermeasures, and an automatic Cloudflare Turnstile solver. Use this for sites protected by Cloudflare, DataDome, or similar services.

§Lifecycle

Both sessions follow the same three-step lifecycle:

  1. Construct::new(config) validates the configuration.
  2. Start.start().await launches the browser and creates a context.
  3. Fetch.fetch(url, params).await navigates and returns a response. You can call fetch multiple times on the same session.
  4. Close.close().await tears down the browser and driver.

Each fetch call automatically retries up to config.retries times with a configurable delay between attempts.

Structs§

DynamicSession
Standard Playwright browser automation session without stealth measures.
StealthySession
Anti-detection browser automation session with optional Cloudflare challenge solving.