# lingmeng101-bot/softly architecture

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

- Interactive diagram: https://gitdiagram.com/lingmeng101-bot/softly
- Repository: https://github.com/lingmeng101-bot/softly

## Overview

softly is a multi-site crawler that starts from configured targets, fetches pages, detects response format, selects a site-specific or generic parser, validates and deduplicates article-like records, then saves them to SQLite and follows pagination. The graph preserves the configured site adapters and the generic JSON/HTML parsing and response guard. Evidence is limited to the README and indexed excerpts; the 30aitool adapter implementation and some helpers were not sampled, so uncertain internal calls are omitted.

Main entry points: [`pipeline.py`](https://github.com/lingmeng101-bot/softly/blob/main/pipeline.py) (Crawl pipeline), [`crawler/sites/__init__.py`](https://github.com/lingmeng101-bot/softly/blob/main/crawler/sites/__init__.py) (Parser selection), [`main.py`](https://github.com/lingmeng101-bot/softly/blob/main/main.py) (Crawler entry), [`crawler/sites/generic.py`](https://github.com/lingmeng101-bot/softly/blob/main/crawler/sites/generic.py) (Generic parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_run["Run and orchestration"]
  node_entry["Crawler entry<br/>[main.py]"]
  node_targets["Target config<br/>[config.py]"]
  node_pipeline["Crawl pipeline<br/>[pipeline.py]"]
  node_paginator["Fallback paginator<br/>[paginator.py]"]
end

subgraph group_fetch["Fetch and format"]
  node_fetcher["HTTP fetcher<br/>[fetcher.py]"]
  node_sniff["Format detection<br/>[sniff.py]"]
end

subgraph group_parse["Parsing adapters"]
  node_parser_registry["Parser selection<br/>[__init__.py]"]
  node_generic["Generic parser<br/>[generic.py]"]
  node_guard["JSON response guard<br/>[guard.py]"]
  node_ahszu["Ahszu adapter<br/>[ahszu.py]"]
  node_xsyu["Xsyu adapter<br/>[xsyu.py]"]
  node_books["Books adapter<br/>[books.py]"]
  node_aitool["Aitool adapter<br/>[aitool30.py]"]
end

subgraph group_persist["Records and persistence"]
  node_article_model["Article model<br/>[models.py]"]
  node_hashing["Dedup hashing<br/>[hashing.py]"]
  node_storage[("SQLite storage<br/>[storage.py]")]
end

node_operator(("Operator"))

node_operator -->|"starts"| node_entry
node_entry -->|"reads targets"| node_targets
node_entry -->|"opens database"| node_storage
node_entry -->|"runs target"| node_pipeline
node_pipeline -->|"fetches page"| node_fetcher
node_pipeline -->|"classifies response"| node_sniff
node_pipeline -->|"selects parser"| node_parser_registry
node_parser_registry -->|"falls back"| node_generic
node_parser_registry -->|"routes host"| node_ahszu
node_parser_registry -->|"routes host"| node_xsyu
node_parser_registry -->|"routes host"| node_books
node_parser_registry -->|"routes host"| node_aitool
node_generic -->|"checks JSON"| node_guard
node_generic -->|"creates records"| node_article_model
node_pipeline -->|"computes keys"| node_hashing
node_pipeline -->|"checks and saves"| node_storage
node_pipeline -->|"falls back to"| node_paginator
node_pipeline -->|"requests next page"| node_books

click node_entry "https://github.com/lingmeng101-bot/softly/blob/main/main.py"
click node_targets "https://github.com/lingmeng101-bot/softly/blob/main/config.py"
click node_pipeline "https://github.com/lingmeng101-bot/softly/blob/main/pipeline.py"
click node_fetcher "https://github.com/lingmeng101-bot/softly/blob/main/crawler/fetcher.py"
click node_sniff "https://github.com/lingmeng101-bot/softly/blob/main/crawler/sniff.py"
click node_parser_registry "https://github.com/lingmeng101-bot/softly/blob/main/crawler/sites/__init__.py"
click node_generic "https://github.com/lingmeng101-bot/softly/blob/main/crawler/sites/generic.py"
click node_guard "https://github.com/lingmeng101-bot/softly/blob/main/crawler/guard.py"
click node_ahszu "https://github.com/lingmeng101-bot/softly/blob/main/crawler/sites/ahszu.py"
click node_xsyu "https://github.com/lingmeng101-bot/softly/blob/main/crawler/sites/xsyu.py"
click node_books "https://github.com/lingmeng101-bot/softly/blob/main/crawler/sites/books.py"
click node_aitool "https://github.com/lingmeng101-bot/softly/blob/main/crawler/sites/aitool30.py"
click node_article_model "https://github.com/lingmeng101-bot/softly/blob/main/models.py"
click node_hashing "https://github.com/lingmeng101-bot/softly/blob/main/hashing.py"
click node_storage "https://github.com/lingmeng101-bot/softly/blob/main/storage.py"
click node_paginator "https://github.com/lingmeng101-bot/softly/blob/main/paginator.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_entry,node_targets,node_pipeline,node_paginator toneBlue
class node_fetcher,node_sniff toneAmber
class node_parser_registry,node_generic,node_guard,node_ahszu,node_xsyu,node_books,node_aitool toneMint
class node_article_model,node_hashing,node_storage toneRose
class node_operator toneIndigo
```

## Components

### Run and orchestration

- [Crawler entry](https://github.com/lingmeng101-bot/softly/blob/main/main.py): `main.py`
- [Target config](https://github.com/lingmeng101-bot/softly/blob/main/config.py): `config.py`
- [Crawl pipeline](https://github.com/lingmeng101-bot/softly/blob/main/pipeline.py): `pipeline.py`
- [Fallback paginator](https://github.com/lingmeng101-bot/softly/blob/main/paginator.py): `paginator.py`

### Fetch and format

- [HTTP fetcher](https://github.com/lingmeng101-bot/softly/blob/main/crawler/fetcher.py): `crawler/fetcher.py`
- [Format detection](https://github.com/lingmeng101-bot/softly/blob/main/crawler/sniff.py): `crawler/sniff.py`

### Parsing adapters

- [Parser selection](https://github.com/lingmeng101-bot/softly/blob/main/crawler/sites/__init__.py): `crawler/sites/__init__.py`
- [Generic parser](https://github.com/lingmeng101-bot/softly/blob/main/crawler/sites/generic.py): `crawler/sites/generic.py`
- [JSON response guard](https://github.com/lingmeng101-bot/softly/blob/main/crawler/guard.py): `crawler/guard.py`
- [Ahszu adapter](https://github.com/lingmeng101-bot/softly/blob/main/crawler/sites/ahszu.py): `crawler/sites/ahszu.py`
- [Xsyu adapter](https://github.com/lingmeng101-bot/softly/blob/main/crawler/sites/xsyu.py): `crawler/sites/xsyu.py`
- [Books adapter](https://github.com/lingmeng101-bot/softly/blob/main/crawler/sites/books.py): `crawler/sites/books.py`
- [Aitool adapter](https://github.com/lingmeng101-bot/softly/blob/main/crawler/sites/aitool30.py): `crawler/sites/aitool30.py`

### Records and persistence

- [Article model](https://github.com/lingmeng101-bot/softly/blob/main/models.py): `models.py`
- [Dedup hashing](https://github.com/lingmeng101-bot/softly/blob/main/hashing.py): `hashing.py`
- [SQLite storage](https://github.com/lingmeng101-bot/softly/blob/main/storage.py): `storage.py`

### Other components

- **Operator**

## Connections

- Operator → Crawler entry: starts (evidence: `README.md`)
- Crawler entry → Target config: reads targets (evidence: `main.py`)
- Crawler entry → SQLite storage: opens database (evidence: `main.py`)
- Crawler entry → Crawl pipeline: runs target (evidence: `main.py`)
- Crawl pipeline → HTTP fetcher: fetches page (evidence: `pipeline.py`)
- Crawl pipeline → Format detection: classifies response (evidence: `pipeline.py`)
- Crawl pipeline → Parser selection: selects parser (evidence: `pipeline.py`)
- Parser selection → Generic parser: falls back (evidence: `crawler/sites/__init__.py`)
- Parser selection → Ahszu adapter: routes host (evidence: `crawler/sites/__init__.py`)
- Parser selection → Xsyu adapter: routes host (evidence: `crawler/sites/__init__.py`)
- Parser selection → Books adapter: routes host (evidence: `crawler/sites/__init__.py`)
- Parser selection → Aitool adapter: routes host (evidence: `crawler/sites/__init__.py`)
- Generic parser → JSON response guard: checks JSON (evidence: `crawler/sites/generic.py`)
- Generic parser → Article model: creates records (evidence: `crawler/sites/generic.py`)
- Crawl pipeline → Dedup hashing: computes keys (evidence: `pipeline.py`)
- Crawl pipeline → SQLite storage: checks and saves (evidence: `pipeline.py`)
- Crawl pipeline → Fallback paginator: falls back to (evidence: `pipeline.py`)
- Crawl pipeline → Books adapter: requests next page (evidence: `README.md`)
