Adaptive Data Scraping Framework (Scrapling Edition)
Trigger (When to Use)
- Batch data scraping: When you need to extract structured data (prices, listings, products, articles) from a set of pages or an entire site, not just a single page operation.
- Target site structure is volatile: When selectors frequently break and you need "record once, auto-follow page changes" adaptive element location.
- Need ready-made spider patterns: For full-site crawling (CrawlSpider), sitemap crawling (SitemapSpider), Feed/Shopify scraping—without writing loops from scratch.
- Need backend API data: When page data actually comes from XHR/fetch endpoints, use
capture_xhrto capture responses directly instead of parsing DOM. - Need structured delivery: Export results directly as JSON/JSONL/CSV/XML into downstream workflows.
When NOT to use it (division of labor):
| Scenario | Use Instead |
|---|---|
| Single page operations (click, form fill, screenshot, logged-in actions) | computer-use or browser-playwright skills |
| Fixed routine automation (same click sequence daily) | browser-playwright skill |
| Multi-account matrix, heavy anti-bot countermeasures, Cloudflare enterprise-level protection | browser-act skill (optional, needs approval) |
| Scraping public page data, sites with frequent structural changes | This skill |
Steps
- Determine scraping tier: For static pages, use
Fetcher(pure HTTP, fastest); for dynamic rendering, useDynamicFetcher(Playwright Chromium); for fingerprint masking, useStealthyFetcher. Use the shallowest tier possible. - Remember key elements: On first parse, use
auto_save=Trueto save element characteristics; on later calls, passadaptive=True—when the page changes, elements are auto-relocated by similarity, no more broken selectors. - Batch tasks with Spider: Declare
start_urls+parsein a declarative style; enableAutoThrottle(dynamically adjusts speed based on server response, backs off on Retry-After headers); for large tasks, enable checkpoint saving (Ctrl+C to resume). - Capture API data directly: When data comes from backend APIs, use
capture_xhrto intercept XHR responses, skipping DOM parsing entirely. - Export to downstream: Built-in export to JSON/JSONL/CSV/XML, direct input to WorkData or file delivery.
- Multi-session: Use session routing (sid) for different targets or anti-bot levels; proxies rotate via ProxyRotator (client-provided proxies).
Boundaries (What NOT to Do)
- Scrape only public data: Target sites must be public pages or authorized by the client; target domains go through fence approval (
fenceParams.targetDomainsRequireApproval); unapproved targets are not scraped. - Respect robots.txt:
respect_robots_txt=Trueis default; disabling requires approval and is logged. - No forced anti-bot bypass: StealthyFetcher's fingerprint masking is for legitimate scraping to avoid false positives;
solve_cloudflare-level countermeasures are off by default and require approval (same discipline asbrowser-act). Akamai/DataDome enterprise protections are not to be circumvented—escalate to human evaluation. - Rate limiting is mandatory: AutoThrottle is always on; daily request cap per target domain is constrained by
fenceParams.dailyActionCap, default starting at 500. - Login sessions are user-managed: API keys and session tokens are stored locally only, never included in skill text or sent outbound.
- Data goes through WorkData three-stage pipeline: PII is sanitized before entering context or leaving the system.
Installation & Dependencies
pip install "scrapling[fetchers]" # Python ≥ 3.10
scrapling install # Download browser dependencies (for DynamicFetcher)
MCP server form (scrapling[ai]) is an optional enhancement, not enabled by default; enabling requires approval and explicit outbound declaration.