# pudeng163/netdisk2weixin architecture

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

- Interactive diagram: https://gitdiagram.com/pudeng163/netdisk2weixin
- Repository: https://github.com/pudeng163/netdisk2weixin

## Overview

This is a unified Baidu/Quark cloud-drive referral tool: it retrieves shared-resource listings, filters and selects items, saves them to the user’s drive, creates replacement share links, and sends results to WeChat Work. Users can run platform jobs from the CLI or Web UI, preview Quark selections, or replace links embedded in supplied text. The README documents the major workflow; some adapter and Web implementation details were not sampled, so unsupported internal calls are omitted.

Main entry points: [`adapters/quark.py`](https://github.com/pudeng163/netdisk2weixin/blob/master/adapters/quark.py) (Quark adapter), [`web/web_app.py`](https://github.com/pudeng163/netdisk2weixin/blob/master/web/web_app.py) (Web backend), [`adapters/baidu.py`](https://github.com/pudeng163/netdisk2weixin/blob/master/adapters/baidu.py) (Baidu adapter), [`main.py`](https://github.com/pudeng163/netdisk2weixin/blob/master/main.py) (CLI entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry points"]
  node_main["CLI entry<br/>[main.py]"]
  node_text["Text replacer<br/>[text_replacer.py]"]
end

subgraph group_workflow["Transfer workflow"]
  node_baidu["Baidu adapter<br/>[baidu.py]"]
  node_quark["Quark adapter<br/>[quark.py]"]
end

subgraph group_core["Shared services"]
  node_cache[("API cache<br/>[cache.py]")]
  node_config["Configuration<br/>[config.py]"]
  node_logger["Logging<br/>[logger.py]"]
  node_notifier["WeChat notifier<br/>[notifier.py]"]
end

subgraph group_web["Web management"]
  node_webapp["Web backend<br/>[web_app.py]"]
  node_template["Management UI<br/>[index.html]"]
end

node_user(("Operator"))
node_aggregator{{"Resource API"}}
node_baidu_service{{"Baidu drive"}}
node_quark_service{{"Quark drive"}}
node_kuake{{"kuake CLI"}}
node_wechat{{"WeChat Work"}}
node_history[("Share history")]
node_preview[("Preview cache")]

node_user -->|"runs"| node_main
node_main -->|"dispatches"| node_baidu
node_main -->|"dispatches"| node_quark
node_main -->|"runs replacement"| node_text
node_main -->|"starts"| node_webapp
node_user -->|"manages"| node_webapp
node_webapp -->|"renders"| node_template
node_webapp -->|"dispatches"| node_baidu
node_webapp -->|"dispatches"| node_quark
node_webapp -->|"stores preview"| node_preview
node_webapp -->|"loads preview"| node_preview
node_baidu -->|"fetches listings"| node_cache
node_quark -->|"fetches listings"| node_cache
node_cache -->|"requests resources"| node_aggregator
node_baidu -->|"verifies and transfers"| node_baidu_service
node_quark -->|"saves and shares"| node_quark_service
node_quark -->|"uploads PDF"| node_kuake
node_baidu -->|"sends results"| node_notifier
node_quark -->|"sends results"| node_notifier
node_notifier -->|"posts notification"| node_wechat
node_quark -->|"records shares"| node_history
node_text -->|"transfers links"| node_baidu
node_text -->|"transfers links"| node_quark
node_text -->|"writes results"| node_history
node_text -->|"pushes results"| node_notifier
node_baidu -->|"loads settings"| node_config
node_quark -->|"loads settings"| node_config
node_cache -->|"uses cache path"| node_config
node_logger -->|"uses log path"| node_config

click node_main "https://github.com/pudeng163/netdisk2weixin/blob/master/main.py"
click node_text "https://github.com/pudeng163/netdisk2weixin/blob/master/core/text_replacer.py"
click node_webapp "https://github.com/pudeng163/netdisk2weixin/blob/master/web/web_app.py"
click node_template "https://github.com/pudeng163/netdisk2weixin/blob/master/web/templates/index.html"
click node_baidu "https://github.com/pudeng163/netdisk2weixin/blob/master/adapters/baidu.py"
click node_quark "https://github.com/pudeng163/netdisk2weixin/blob/master/adapters/quark.py"
click node_cache "https://github.com/pudeng163/netdisk2weixin/blob/master/core/cache.py"
click node_config "https://github.com/pudeng163/netdisk2weixin/blob/master/core/config.py"
click node_logger "https://github.com/pudeng163/netdisk2weixin/blob/master/core/logger.py"
click node_notifier "https://github.com/pudeng163/netdisk2weixin/blob/master/core/notifier.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_main,node_text toneBlue
class node_baidu,node_quark,node_history,node_preview toneAmber
class node_cache,node_config,node_logger,node_notifier,node_aggregator toneMint
class node_webapp,node_template toneRose
class node_user,node_baidu_service,node_quark_service,node_kuake,node_wechat toneIndigo
```

## Components

### Entry points

- [CLI entry](https://github.com/pudeng163/netdisk2weixin/blob/master/main.py): `main.py`
- [Text replacer](https://github.com/pudeng163/netdisk2weixin/blob/master/core/text_replacer.py): `core/text_replacer.py`

### Transfer workflow

- [Baidu adapter](https://github.com/pudeng163/netdisk2weixin/blob/master/adapters/baidu.py): `adapters/baidu.py`
- [Quark adapter](https://github.com/pudeng163/netdisk2weixin/blob/master/adapters/quark.py): `adapters/quark.py`

### Shared services

- [API cache](https://github.com/pudeng163/netdisk2weixin/blob/master/core/cache.py): `core/cache.py`
- [Configuration](https://github.com/pudeng163/netdisk2weixin/blob/master/core/config.py): `core/config.py`
- [Logging](https://github.com/pudeng163/netdisk2weixin/blob/master/core/logger.py): `core/logger.py`
- [WeChat notifier](https://github.com/pudeng163/netdisk2weixin/blob/master/core/notifier.py): `core/notifier.py`

### Web management

- [Web backend](https://github.com/pudeng163/netdisk2weixin/blob/master/web/web_app.py): `web/web_app.py`
- [Management UI](https://github.com/pudeng163/netdisk2weixin/blob/master/web/templates/index.html): `web/templates/index.html`

### Other components

- **Operator**
- **Resource API**
- **Baidu drive**
- **Quark drive**
- **kuake CLI**
- **WeChat Work**
- **Share history**
- **Preview cache**

## Connections

- Operator → CLI entry: runs (evidence: `README.md`)
- CLI entry → Baidu adapter: dispatches (evidence: `main.py`)
- CLI entry → Quark adapter: dispatches (evidence: `main.py`)
- CLI entry → Text replacer: runs replacement (evidence: `main.py`)
- CLI entry → Web backend: starts (evidence: `main.py`)
- Operator → Web backend: manages (evidence: `README.md`)
- Web backend → Management UI: renders (evidence: `web/web_app.py`)
- Web backend → Baidu adapter: dispatches (evidence: `web/web_app.py`)
- Web backend → Quark adapter: dispatches (evidence: `web/web_app.py`)
- Web backend → Preview cache: stores preview (evidence: `web/web_app.py`)
- Web backend → Preview cache: loads preview (evidence: `web/web_app.py`)
- Baidu adapter → API cache: fetches listings (evidence: `adapters/baidu.py`)
- Quark adapter → API cache: fetches listings (evidence: `adapters/quark.py`)
- API cache → Resource API: requests resources (evidence: `core/cache.py`)
- Baidu adapter → Baidu drive: verifies and transfers (evidence: `adapters/baidu.py`)
- Quark adapter → Quark drive: saves and shares (evidence: `adapters/quark.py`)
- Quark adapter → kuake CLI: uploads PDF (evidence: `adapters/quark.py`)
- Baidu adapter → WeChat notifier: sends results (evidence: `adapters/baidu.py`)
- Quark adapter → WeChat notifier: sends results (evidence: `adapters/quark.py`)
- WeChat notifier → WeChat Work: posts notification (evidence: `core/notifier.py`)
- Quark adapter → Share history: records shares (evidence: `adapters/quark.py`)
- Text replacer → Baidu adapter: transfers links (evidence: `core/text_replacer.py`)
- Text replacer → Quark adapter: transfers links (evidence: `core/text_replacer.py`)
- Text replacer → Share history: writes results (evidence: `core/text_replacer.py`)
- Text replacer → WeChat notifier: pushes results (evidence: `core/text_replacer.py`)
- Baidu adapter → Configuration: loads settings (evidence: `adapters/baidu.py`)
- Quark adapter → Configuration: loads settings (evidence: `adapters/quark.py`)
- API cache → Configuration: uses cache path (evidence: `core/cache.py`)
- Logging → Configuration: uses log path (evidence: `core/logger.py`)
