# pennypenny135-coder/scrapling architecture

> Architecture diagram of the GitHub repository pennypenny135-coder/scrapling, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pennypenny135-coder/scrapling
- Repository: https://github.com/pennypenny135-coder/scrapling

## Overview

Scrapling is a web-scraping framework: users fetch individual pages or run spiders, then select and extract page data from adaptive parsed responses. Its main runtime branches cover HTTP and browser-based fetching, adaptive selection, and managed crawling; spider templates and the Scrapy adapter extend those workflows. Edges follow README claims and the supplied source excerpts or index references; unsampled implementation details are not inferred beyond those references.

Main entry points: [`scrapling/spiders/engine.py`](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/spiders/engine.py) (Crawler engine), [`scrapling/engines/_browsers/_base.py`](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/engines/_browsers/_base.py) (Browser runtime), [`scrapling/spiders/session.py`](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/spiders/session.py) (Session manager), [`scrapling/engines/toolbelt/convertor.py`](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/engines/toolbelt/convertor.py) (Response conversion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_fetch["Fetching"]
  node_http["HTTP fetchers<br/>[requests.py]"]
  node_static["HTTP engine<br/>[static.py]"]
  node_browser["Browser fetchers<br/>[chrome.py]"]
  node_stealth["Stealth browser<br/>[stealth_chrome.py]"]
  node_browserbase["Browser runtime<br/>[_base.py]"]
  node_controllers["Browser controllers<br/>[_controllers.py]"]
  node_rotation["Proxy rotation<br/>[proxy_rotation.py]"]
  node_responseconvert["Response conversion<br/>[convertor.py]"]
end

subgraph group_parse["Parsing and extraction"]
  node_response["Scraped response<br/>[custom.py]"]
  node_parser["Adaptive parser<br/>[parser.py]"]
  node_selection["Element selection<br/>[shell.py]"]
  node_ai["AI extraction<br/>[ai.py]"]
end

subgraph group_crawl["Spider crawling"]
  node_spider["Spider definition<br/>[spider.py]"]
  node_engine["Crawler engine<br/>[engine.py]"]
  node_request["Crawl requests<br/>[request.py]"]
  node_sessions["Session manager<br/>[session.py]"]
  node_scheduler["Request scheduler<br/>[scheduler.py]"]
  node_crawlresult["Crawl results<br/>[result.py]"]
  node_templates["Spider templates"]
end

subgraph group_extend["Interfaces and extensions"]
  node_cli["Command-line tools<br/>[cli.py]"]
  node_scrapy["Scrapy adapter<br/>[scrapy.py]"]
end

node_user(("Scraper"))

node_user -->|"fetches pages"| node_http
node_user -->|"fetches pages"| node_browser
node_user -->|"fetches stealthily"| node_stealth
node_user -->|"defines crawl"| node_spider
node_http -->|"uses"| node_static
node_browser -->|"uses"| node_controllers
node_stealth -->|"uses"| node_browserbase
node_controllers -->|"delegates to"| node_browserbase
node_static -->|"converts responses"| node_responseconvert
node_browserbase -->|"converts responses"| node_responseconvert
node_responseconvert -->|"builds response"| node_response
node_response -->|"extends selection"| node_parser
node_parser -->|"uses utilities"| node_selection
node_user -->|"extracts data"| node_selection
node_user -.->|"requests extraction"| node_ai
node_spider -->|"starts crawl"| node_engine
node_spider -->|"configures sessions"| node_sessions
node_engine -->|"schedules requests"| node_scheduler
node_engine -->|"fetches requests"| node_sessions
node_engine -->|"processes requests"| node_request
node_engine -->|"collects results"| node_crawlresult
node_sessions -->|"uses HTTP sessions"| node_static
node_sessions -->|"uses response type"| node_responseconvert
node_browserbase -.->|"supports proxies"| node_rotation
node_stealth -.->|"supports proxies"| node_rotation
node_user -->|"uses crawl templates"| node_templates
node_user -.->|"runs commands"| node_cli
node_scrapy -.->|"adapts responses"| node_response

click node_http "https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/fetchers/requests.py"
click node_static "https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/engines/static.py"
click node_browser "https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/fetchers/chrome.py"
click node_stealth "https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/fetchers/stealth_chrome.py"
click node_browserbase "https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/engines/_browsers/_base.py"
click node_controllers "https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/engines/_browsers/_controllers.py"
click node_rotation "https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/engines/toolbelt/proxy_rotation.py"
click node_responseconvert "https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/engines/toolbelt/convertor.py"
click node_response "https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/engines/toolbelt/custom.py"
click node_parser "https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/parser.py"
click node_selection "https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/core/shell.py"
click node_ai "https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/core/ai.py"
click node_spider "https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/spiders/spider.py"
click node_engine "https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/spiders/engine.py"
click node_request "https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/spiders/request.py"
click node_sessions "https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/spiders/session.py"
click node_scheduler "https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/spiders/scheduler.py"
click node_crawlresult "https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/spiders/result.py"
click node_templates "https://github.com/pennypenny135-coder/scrapling/tree/main/scrapling/spiders/templates"
click node_cli "https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/cli.py"
click node_scrapy "https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/integrations/scrapy.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_http,node_static,node_browser,node_stealth,node_browserbase,node_controllers,node_rotation,node_responseconvert toneBlue
class node_response,node_parser,node_selection,node_ai toneAmber
class node_spider,node_engine,node_request,node_sessions,node_scheduler,node_crawlresult,node_templates toneMint
class node_cli,node_scrapy toneRose
class node_user toneIndigo
```

## Components

### Fetching

- [HTTP fetchers](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/fetchers/requests.py): `scrapling/fetchers/requests.py`
- [HTTP engine](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/engines/static.py): `scrapling/engines/static.py`
- [Browser fetchers](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/fetchers/chrome.py): `scrapling/fetchers/chrome.py`
- [Stealth browser](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/fetchers/stealth_chrome.py): `scrapling/fetchers/stealth_chrome.py`
- [Browser runtime](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/engines/_browsers/_base.py): `scrapling/engines/_browsers/_base.py`
- [Browser controllers](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/engines/_browsers/_controllers.py): `scrapling/engines/_browsers/_controllers.py`
- [Proxy rotation](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/engines/toolbelt/proxy_rotation.py): `scrapling/engines/toolbelt/proxy_rotation.py`
- [Response conversion](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/engines/toolbelt/convertor.py): `scrapling/engines/toolbelt/convertor.py`

### Parsing and extraction

- [Scraped response](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/engines/toolbelt/custom.py): `scrapling/engines/toolbelt/custom.py`
- [Adaptive parser](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/parser.py): `scrapling/parser.py`
- [Element selection](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/core/shell.py): `scrapling/core/shell.py`
- [AI extraction](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/core/ai.py): `scrapling/core/ai.py`

### Spider crawling

- [Spider definition](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/spiders/spider.py): `scrapling/spiders/spider.py`
- [Crawler engine](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/spiders/engine.py): `scrapling/spiders/engine.py`
- [Crawl requests](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/spiders/request.py): `scrapling/spiders/request.py`
- [Session manager](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/spiders/session.py): `scrapling/spiders/session.py`
- [Request scheduler](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/spiders/scheduler.py): `scrapling/spiders/scheduler.py`
- [Crawl results](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/spiders/result.py): `scrapling/spiders/result.py`
- [Spider templates](https://github.com/pennypenny135-coder/scrapling/tree/main/scrapling/spiders/templates): `scrapling/spiders/templates`

### Interfaces and extensions

- [Command-line tools](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/cli.py): `scrapling/cli.py`
- [Scrapy adapter](https://github.com/pennypenny135-coder/scrapling/blob/main/scrapling/integrations/scrapy.py): `scrapling/integrations/scrapy.py`

### Other components

- **Scraper**

## Connections

- Scraper → HTTP fetchers: fetches pages
- Scraper → Browser fetchers: fetches pages
- Scraper → Stealth browser: fetches stealthily
- Scraper → Spider definition: defines crawl
- HTTP fetchers → HTTP engine: uses (evidence: `scrapling/fetchers/requests.py`)
- Browser fetchers → Browser controllers: uses (evidence: `scrapling/fetchers/chrome.py`)
- Stealth browser → Browser runtime: uses (evidence: `scrapling/fetchers/stealth_chrome.py`)
- Browser controllers → Browser runtime: delegates to (evidence: `scrapling/engines/_browsers/_controllers.py`)
- HTTP engine → Response conversion: converts responses (evidence: `scrapling/engines/static.py`)
- Browser runtime → Response conversion: converts responses (evidence: `scrapling/engines/_browsers/_base.py`)
- Response conversion → Scraped response: builds response (evidence: `scrapling/engines/toolbelt/convertor.py`)
- Scraped response → Adaptive parser: extends selection (evidence: `scrapling/engines/toolbelt/custom.py`)
- Adaptive parser → Element selection: uses utilities (evidence: `scrapling/parser.py`)
- Scraper → Element selection: extracts data
- Scraper → AI extraction: requests extraction
- Spider definition → Crawler engine: starts crawl (evidence: `scrapling/spiders/spider.py`)
- Spider definition → Session manager: configures sessions (evidence: `scrapling/spiders/spider.py`)
- Crawler engine → Request scheduler: schedules requests (evidence: `scrapling/spiders/engine.py`)
- Crawler engine → Session manager: fetches requests (evidence: `scrapling/spiders/engine.py`)
- Crawler engine → Crawl requests: processes requests (evidence: `scrapling/spiders/engine.py`)
- Crawler engine → Crawl results: collects results (evidence: `scrapling/spiders/engine.py`)
- Session manager → HTTP engine: uses HTTP sessions (evidence: `scrapling/spiders/session.py`)
- Session manager → Response conversion: uses response type (evidence: `scrapling/spiders/session.py`)
- Browser runtime → Proxy rotation: supports proxies
- Stealth browser → Proxy rotation: supports proxies
- Scraper → Spider templates: uses crawl templates
- Scraper → Command-line tools: runs commands
- Scrapy adapter → Scraped response: adapts responses (evidence: `scrapling/integrations/scrapy.py`)
