Skip to content

API Reference parrot_tools.scraping.crawler

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.scraping.crawler

View source

CrawlEngine — multi-page crawl orchestrator for the WebScrapingToolkit.

Coordinates CrawlGraph (state), CrawlStrategy (traversal order), LinkDiscoverer (link extraction), and a caller-provided scrape_fn (page execution) to perform breadth-first or depth-first crawls across multiple pages.

This module is not exposed as a standalone tool; the public interface is WebScrapingToolkit.crawl().

Alias BFSStrategy

Re-exported from parrot_tools.scraping.crawl_strategy.BFSStrategy.

Class CrawlEngine

Orchestrates multi-page crawling.

Parameter Type Default Description
scrape_fn Callable[..., Awaitable[Any]] Async callable (url, plan) -> result that scrapes a single page. The result object must expose a raw_html attribute (or similar) for link discovery.
strategy Optional[CrawlStrategy] None Traversal strategy; defaults to BFSStrategy.
follow_selector str 'a[href]' Default CSS selector for link elements.
follow_pattern Optional[str] None Default regex pattern to filter discovered URLs.
allow_external bool False Whether to follow links outside the start domain.
concurrency int 1 Number of concurrent page scrapes. 1 (default) is safe for all drivers; higher values require concurrent-capable drivers.
logger Optional[logging.Logger] None Optional logger; one is created if not provided.

Method CrawlEngine.run

Execute the crawl and return aggregated results.

run(start_url: str, plan: Any, depth: int = 1, max_pages: Optional[int] = None) -> CrawlResult

Parameter Type Default Description
start_url str Seed URL for the crawl.
plan Any Scraping plan object; its follow_selector, follow_pattern, and max_depth attributes are used as hints when available.
depth int 1 Maximum crawl depth (0 = only start_url).
max_pages Optional[int] None Hard cap on total pages scraped.

Returns: CrawlResult — A CrawlResult summarising the crawl session.

Alias CrawlGraph

Re-exported from parrot_tools.scraping.crawl_graph.CrawlGraph.

Alias CrawlNode

Re-exported from parrot_tools.scraping.crawl_graph.CrawlNode.

Alias CrawlResult

Re-exported from parrot_tools.scraping.crawl_graph.CrawlResult.

Alias CrawlStrategy

Re-exported from parrot_tools.scraping.crawl_strategy.CrawlStrategy.

Alias LinkDiscoverer

Re-exported from parrot_tools.scraping.link_discoverer.LinkDiscoverer.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally