# yibeigen/wechat-article-exporter architecture

> Architecture diagram of the GitHub repository yibeigen/wechat-article-exporter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yibeigen/wechat-article-exporter
- Repository: https://github.com/yibeigen/wechat-article-exporter

## Overview

BlogDistiller collects and archives articles from nine blogging platforms through three documented routes: a desktop client for WeChat, a browser extension for Zhihu and Weibo, and a Web workbench for other supported platforms. The backend discovers article lists, retrieves selected article details, cleans content, and produces downloadable multi-format exports. Authentication and cached task state support protected-platform access and resumable batch work. The README documents these capabilities; the supplied source excerpts are partial, so some client-to-backend and exporter wiring is shown only where documented or evidenced.

Main entry points: [`backend/app/main.py`](https://github.com/yibeigen/wechat-article-exporter/blob/main/backend/app/main.py) (API orchestration), [`backend/app/task_manager.py`](https://github.com/yibeigen/wechat-article-exporter/blob/main/backend/app/task_manager.py) (Batch task manager), [`desktop/main.js`](https://github.com/yibeigen/wechat-article-exporter/blob/main/desktop/main.js) (WeChat desktop), [`frontend/extension/background.js`](https://github.com/yibeigen/wechat-article-exporter/blob/main/frontend/extension/background.js) (Extension background)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User clients"]
  node_web["Web API and workbench<br/>[main.py]"]
  node_desktop["WeChat desktop<br/>[main.js]"]
  node_extension["Browser extension<br/>[popup.js]"]
  node_extension_worker["Extension background<br/>[background.js]"]
  node_platform_page["Platform page scripts<br/>[content.js]"]
  node_wechat_page["WeChat page helper<br/>[wechat_content.js]"]
end

subgraph group_service["Collection service"]
  node_api["API orchestration<br/>[main.py]"]
  node_tasks["Batch task manager<br/>[task_manager.py]"]
  node_scrapers["Platform scrapers"]
  node_models["Article models<br/>[models.py]"]
  node_cache[("Task and article cache<br/>[cache.py]")]
end

subgraph group_access["Platform access"]
  node_wechat_auth["WeChat credentials<br/>[wechat_auth.py]"]
  node_social_auth["Social credentials"]
end

subgraph group_archive["Cleaning and export"]
  node_cleaner["HTML cleaning<br/>[html_cleaner.py]"]
  node_noise["Noise filtering<br/>[noise_filter.py]"]
  node_exporters["Format exporters"]
  node_zip_export["ZIP archive export<br/>[zip_exporter.py]"]
end

node_user(("Article seeker"))
node_platforms(("Blog platforms"))
node_download(("Export download"))

node_user -->|"submits URLs"| node_web
node_user -->|"provides WeChat URL"| node_desktop
node_user -->|"requests extraction"| node_extension
node_extension -->|"dispatches request"| node_extension_worker
node_extension_worker -->|"messages page"| node_platform_page
node_extension_worker -->|"opens workbench"| node_web
node_wechat_page -->|"fetches articles"| node_platforms
node_desktop -->|"retrieves WeChat data"| node_platforms
node_web -->|"submits collection"| node_api
node_api -->|"discovers articles"| node_scrapers
node_api -->|"starts batch"| node_tasks
node_tasks -->|"fetches details"| node_scrapers
node_scrapers -->|"requests article data"| node_platforms
node_tasks -->|"builds article records"| node_models
node_tasks -->|"reads and writes"| node_cache
node_tasks -->|"cleans article HTML"| node_cleaner
node_cleaner -->|"filters noise"| node_noise
node_tasks -->|"generates formats"| node_exporters
node_exporters -->|"builds archive"| node_zip_export
node_api -->|"serves export"| node_download
node_desktop -.->|"uses saved credentials"| node_wechat_auth
node_api -->|"checks credentials"| node_wechat_auth
node_api -->|"manages login state"| node_social_auth

click node_web "https://github.com/yibeigen/wechat-article-exporter/blob/main/backend/app/main.py"
click node_desktop "https://github.com/yibeigen/wechat-article-exporter/blob/main/desktop/main.js"
click node_extension "https://github.com/yibeigen/wechat-article-exporter/blob/main/frontend/extension/popup.js"
click node_extension_worker "https://github.com/yibeigen/wechat-article-exporter/blob/main/frontend/extension/background.js"
click node_platform_page "https://github.com/yibeigen/wechat-article-exporter/blob/main/frontend/extension/content.js"
click node_wechat_page "https://github.com/yibeigen/wechat-article-exporter/blob/main/frontend/extension/wechat_content.js"
click node_api "https://github.com/yibeigen/wechat-article-exporter/blob/main/backend/app/main.py"
click node_tasks "https://github.com/yibeigen/wechat-article-exporter/blob/main/backend/app/task_manager.py"
click node_scrapers "https://github.com/yibeigen/wechat-article-exporter/tree/main/backend/app/scrapers"
click node_models "https://github.com/yibeigen/wechat-article-exporter/blob/main/backend/app/models.py"
click node_wechat_auth "https://github.com/yibeigen/wechat-article-exporter/blob/main/backend/app/core/wechat_auth.py"
click node_social_auth "https://github.com/yibeigen/wechat-article-exporter/tree/main/backend/app/core"
click node_cleaner "https://github.com/yibeigen/wechat-article-exporter/blob/main/backend/app/cleaners/html_cleaner.py"
click node_noise "https://github.com/yibeigen/wechat-article-exporter/blob/main/backend/app/cleaners/noise_filter.py"
click node_exporters "https://github.com/yibeigen/wechat-article-exporter/tree/main/backend/app/exporters"
click node_zip_export "https://github.com/yibeigen/wechat-article-exporter/blob/main/backend/app/exporters/zip_exporter.py"
click node_cache "https://github.com/yibeigen/wechat-article-exporter/blob/main/backend/app/core/cache.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_web,node_desktop,node_extension,node_extension_worker,node_platform_page,node_wechat_page toneBlue
class node_api,node_tasks,node_scrapers,node_models,node_cache toneAmber
class node_wechat_auth,node_social_auth toneMint
class node_cleaner,node_noise,node_exporters,node_zip_export toneRose
class node_user,node_platforms,node_download toneIndigo
```

## Components

### User clients

- [Web API and workbench](https://github.com/yibeigen/wechat-article-exporter/blob/main/backend/app/main.py): `backend/app/main.py`
- [WeChat desktop](https://github.com/yibeigen/wechat-article-exporter/blob/main/desktop/main.js): `desktop/main.js`
- [Browser extension](https://github.com/yibeigen/wechat-article-exporter/blob/main/frontend/extension/popup.js): `frontend/extension/popup.js`
- [Extension background](https://github.com/yibeigen/wechat-article-exporter/blob/main/frontend/extension/background.js): `frontend/extension/background.js`
- [Platform page scripts](https://github.com/yibeigen/wechat-article-exporter/blob/main/frontend/extension/content.js): `frontend/extension/content.js`
- [WeChat page helper](https://github.com/yibeigen/wechat-article-exporter/blob/main/frontend/extension/wechat_content.js): `frontend/extension/wechat_content.js`

### Collection service

- [API orchestration](https://github.com/yibeigen/wechat-article-exporter/blob/main/backend/app/main.py): `backend/app/main.py`
- [Batch task manager](https://github.com/yibeigen/wechat-article-exporter/blob/main/backend/app/task_manager.py): `backend/app/task_manager.py`
- [Platform scrapers](https://github.com/yibeigen/wechat-article-exporter/tree/main/backend/app/scrapers): `backend/app/scrapers`
- [Article models](https://github.com/yibeigen/wechat-article-exporter/blob/main/backend/app/models.py): `backend/app/models.py`
- [Task and article cache](https://github.com/yibeigen/wechat-article-exporter/blob/main/backend/app/core/cache.py): `backend/app/core/cache.py`

### Platform access

- [WeChat credentials](https://github.com/yibeigen/wechat-article-exporter/blob/main/backend/app/core/wechat_auth.py): `backend/app/core/wechat_auth.py`
- [Social credentials](https://github.com/yibeigen/wechat-article-exporter/tree/main/backend/app/core): `backend/app/core`

### Cleaning and export

- [HTML cleaning](https://github.com/yibeigen/wechat-article-exporter/blob/main/backend/app/cleaners/html_cleaner.py): `backend/app/cleaners/html_cleaner.py`
- [Noise filtering](https://github.com/yibeigen/wechat-article-exporter/blob/main/backend/app/cleaners/noise_filter.py): `backend/app/cleaners/noise_filter.py`
- [Format exporters](https://github.com/yibeigen/wechat-article-exporter/tree/main/backend/app/exporters): `backend/app/exporters`
- [ZIP archive export](https://github.com/yibeigen/wechat-article-exporter/blob/main/backend/app/exporters/zip_exporter.py): `backend/app/exporters/zip_exporter.py`

### Other components

- **Article seeker**
- **Blog platforms**
- **Export download**

## Connections

- Article seeker → Web API and workbench: submits URLs
- Article seeker → WeChat desktop: provides WeChat URL
- Article seeker → Browser extension: requests extraction
- Browser extension → Extension background: dispatches request
- Extension background → Platform page scripts: messages page
- Extension background → Web API and workbench: opens workbench
- WeChat page helper → Blog platforms: fetches articles
- WeChat desktop → Blog platforms: retrieves WeChat data
- Web API and workbench → API orchestration: submits collection
- API orchestration → Platform scrapers: discovers articles
- API orchestration → Batch task manager: starts batch
- Batch task manager → Platform scrapers: fetches details
- Platform scrapers → Blog platforms: requests article data
- Batch task manager → Article models: builds article records
- Batch task manager → Task and article cache: reads and writes
- Batch task manager → HTML cleaning: cleans article HTML
- HTML cleaning → Noise filtering: filters noise
- Batch task manager → Format exporters: generates formats
- Format exporters → ZIP archive export: builds archive
- API orchestration → Export download: serves export
- WeChat desktop → WeChat credentials: uses saved credentials
- API orchestration → WeChat credentials: checks credentials
- API orchestration → Social credentials: manages login state
