# Repository Briefing: D4Vinci/Scrapling
> Source: https://repoforai.com/repo/D4Vinci/Scrapling (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/D4Vinci/Scrapling
- **Official Docs / Website**: https://scrapling.readthedocs.io/en/latest/
- **Category**: RAG, Data & Memory (知识库 / 爬虫 / 记忆层)
- **Primary Language**: Python
- **License**: BSD-3-Clause
- **Engineering Health**: A+ (98/100 · Maintenance 35/35 · Adoption 23/25 · Releases 20/20 · License 20/20)
- **Latest Release**: v0.5.2 (2026-11-29) — https://github.com/D4Vinci/Scrapling/releases
- **Review Snapshot**: 2026-12-04
- **Deployment / Stack Signals**: Docker, MCP, Self-Hosted, CLI, API
- **Momentum**: 107,904 ★ total (+118 24h / +1,784 7d) · 11,370 forks
- **Topics**: `ai`, `ai-scraping`, `automation`, `crawler`, `crawling`, `crawling-python`, `data`, `data-extraction`, `mcp`, `mcp-server`, `playwright`, `python`
- **When to Use**: Best for: Teams turning authorized documentation sites, help centers, or feeds into structured records or Markdown, especially when static and JavaScript-rendered pages must share one crawl pipeline. Skip if: You need an end-to-end RAG database or retrieval service, or a simple parser already covers your static pages.

## Overview
```text
### Architecture & Core Mechanics
Scrapling is a Python acquisition and extraction layer for RAG, not a database. `Fetcher` handles direct HTTP requests, while Chromium-backed fetchers render and interact with JavaScript pages. The returned page exposes a common DOM extraction interface across fetch paths. Persistent sessions retain cookies and browser state, and a spider can route requests by session ID so only pages that need rendering incur browser overhead.

The crawler follows a Scrapy-like model: `start_urls` seeds requests, and asynchronous `parse` callbacks yield records or follow-up requests through `Request` and `Response` objects. Python and the CLI provide direct access; MCP exposes fetching and browser operations to agents. CDP is a separate integration surface for connecting to an existing browser. The package builds with setuptools and wheel; the Docker build uses `uv` and installs Chromium through Patchright.

### Key Capabilities & Differentiators
Extraction combines CSS, XPath, text, and regex queries with DOM traversal, generated selectors, and similarity-based element relocation. Adaptive matching can recover from some layout changes, but a match is not proof that the field still has the same meaning. Browser sessions can retain state and record background API responses. `page.markdown()` and the `ContentSpider` template produce Markdown without an LLM, leaving document chunking and retrieval to downstream components.

For batch collection, spiders support configurable concurrency, per-domain delays, AutoThrottle with `Retry-After` handling, and optional robots.txt enforcement. `crawldir` preserves pending requests and seen URLs for restart, while development mode replays saved responses to test parsing without fetching again. Sitemap, link-following, and feed templates cover common discovery patterns. Jobs can stream records as they arrive or export JSON, JSONL, CSV, or XML.

### Trade-offs & Limitations
The strongest reason to choose Scrapling over a standalone BeautifulSoup-style parser is that one interface spans acquisition, parsing, and crawling. If an existing Scrapy setup already handles scheduling and downloads well, adopting only the parser through `scrapling_response` is a smaller change than migrating spiders. HTTP-first routing avoids paying Chromium's CPU and memory cost on static HTML; browser-backed requests add rendering coverage but make throughput more sensitive to page complexity and session concurrency.

Validate adaptive extraction against known results: a plausible but wrong match can quietly contaminate a RAG corpus. Likewise, a resumable crawl directory is not a document store or retrieval index, and Markdown output does not replace deduplication or source tracking. Keep those responsibilities downstream. BSD-3-Clause governs use and redistribution of the software, not permission to collect site content; configure crawl limits and authorization for each source.

### Hardware & Deployment Guide
For static pages, start with the Python API or CLI and a direct HTTP fetcher. Add Chromium only where rendering or interaction is required. The supplied Dockerfile uses `python:3.12-slim-trixie`, syncs Python extras with `uv`, and installs Chromium and its system dependencies through Patchright. A browser can also run separately and be reached over CDP. HTML parsing and Markdown conversion require no model inference; CPU and memory sizing should be based on rendered page complexity and concurrent browser sessions, not VRAM.

For a self-hosted agent integration, MCP supports HTTP transport with authentication options. Restrict its network reach and protect persisted login state; store crawl state on persistent storage if restarts must survive container replacement. The v0.5 line introduced broad interface changes, v0.5.1 expanded browser interaction and remote sessions, and v0.5.2 notes breaking changes for spiders, HTTP uploads, and custom browser paths. Pin the deployed version and regression-test those paths before upgrading.
```

## Key Capabilities
```text
- Fetching: Direct HTTP and Chromium-backed sessions can share one spider, with requests routed by session ID.
- Extraction: CSS, XPath, text, and regex selectors share a DOM API; similarity matching can relocate elements after layout changes.
- Crawl control: Per-domain throttling and Retry-After handling complement `crawldir` checkpoints and disk-backed response replay.
- RAG ingestion: `page.markdown()` converts individual pages, while `ContentSpider` builds a site-wide corpus without LLM inference.
- Outputs: Streaming yields items during a crawl, and built-in exporters write JSON, JSONL, CSV, or XML.
- Integration: Python and CLI entry points support direct use; MCP adds agent access, and CDP connects to a separately running browser.
```

## Quick Start / Clone
```bash
pip install "scrapling[shell]"
scrapling shell
```
