# wangshaoxinya/zhihuishuapi architecture

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

- Interactive diagram: https://gitdiagram.com/wangshaoxinya/zhihuishuapi
- Repository: https://github.com/wangshaoxinya/zhihuishuapi

## Overview

This is a PySide6 desktop assistant for Zhihuishu course study. The principal workflow is: the user signs in through the embedded browser, the app obtains course and video information, the user selects videos for batch processing, and the app reports study progress while showing updates. The map includes the documented WebSocket course-selection interface and slider verification. Several modules are represented from README capabilities and filenames because their implementations were not sampled; uncertain connections are omitted rather than inferred.

Main entry points: [`components/main_window.py`](https://github.com/wangshaoxinya/zhihuishuapi/blob/main/components/main_window.py) (Main window), [`main.py`](https://github.com/wangshaoxinya/zhihuishuapi/blob/main/main.py) (Application startup), [`modules/Report_progress.py`](https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/Report_progress.py) (Progress reporting), [`modules/auth_http_server.py`](https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/auth_http_server.py) (Token receiver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop application"]
  node_app["Application startup<br/>[main.py]"]
  node_window["Main window<br/>[main_window.py]"]
  node_browser["Embedded browser<br/>[main_window.py]"]
  node_config["Configuration<br/>[config.py]"]
  node_logger["Logging<br/>[logger.py]"]
end

subgraph group_identity["Login and identity"]
  node_auth_http["Token receiver"]
  node_auth_manager["Auth manager<br/>[auth.py]"]
  node_slider["Slider verification"]
end

subgraph group_study["Course study"]
  node_course_list["Course retrieval<br/>[List_Retrieval.py]"]
  node_video_catalog["Video catalog<br/>[videos.py]"]
  node_queue["Batch study queue<br/>[Line_up.py]"]
  node_progress["Progress reporting<br/>[Report_progress.py]"]
end

subgraph group_realtime["Web interface and updates"]
  node_course_ui["Course selection UI<br/>[web.py]"]
  node_ws["WebSocket server<br/>[web.py]"]
  node_status["Progress display<br/>[main_window.py]"]
end

node_user(("User"))
node_login_page["Zhihuishu login"]
node_auth_service["Token service"]
node_course_api["Zhihuishu study API"]
node_progress_api["Study progress API"]

node_user -->|"uses"| node_window
node_app -->|"opens"| node_window
node_app -->|"loads"| node_config
node_app -->|"logs errors"| node_logger
node_window -->|"hosts"| node_browser
node_browser -->|"shows"| node_login_page
node_login_page -->|"posts token"| node_auth_http
node_auth_http -->|"exchanges token"| node_auth_manager
node_auth_manager -->|"requests token"| node_auth_service
node_browser -.->|"verifies challenge"| node_slider
node_window -->|"retrieves courses"| node_course_list
node_course_list -->|"requests course data"| node_course_api
node_window -->|"opens study interface"| node_course_ui
node_course_ui -->|"sends selections"| node_ws
node_ws -->|"dispatches commands"| node_window
node_window -->|"loads videos"| node_video_catalog
node_window -->|"starts batch study"| node_queue
node_queue -->|"reports video progress"| node_progress
node_progress -->|"posts study records"| node_progress_api
node_window -->|"updates progress"| node_status
node_progress -->|"emits progress"| node_status

click node_app "https://github.com/wangshaoxinya/zhihuishuapi/blob/main/main.py"
click node_window "https://github.com/wangshaoxinya/zhihuishuapi/blob/main/components/main_window.py"
click node_browser "https://github.com/wangshaoxinya/zhihuishuapi/blob/main/components/main_window.py"
click node_auth_http "https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/auth_http_server.py"
click node_auth_manager "https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/auth.py"
click node_slider "https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/slider_verify_async.py"
click node_course_list "https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/List_Retrieval.py"
click node_course_ui "https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/web.py"
click node_ws "https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/web.py"
click node_video_catalog "https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/videos.py"
click node_queue "https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/Line_up.py"
click node_progress "https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/Report_progress.py"
click node_status "https://github.com/wangshaoxinya/zhihuishuapi/blob/main/components/main_window.py"
click node_config "https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/config.py"
click node_logger "https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/logger.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_app,node_window,node_browser,node_config,node_logger,node_user toneBlue
class node_auth_http,node_auth_manager,node_slider toneAmber
class node_course_list,node_video_catalog,node_queue,node_progress,node_course_api,node_progress_api toneMint
class node_course_ui,node_ws,node_status toneRose
class node_login_page,node_auth_service toneIndigo
```

## Components

### Desktop application

- [Application startup](https://github.com/wangshaoxinya/zhihuishuapi/blob/main/main.py): `main.py`
- [Main window](https://github.com/wangshaoxinya/zhihuishuapi/blob/main/components/main_window.py): `components/main_window.py`
- [Embedded browser](https://github.com/wangshaoxinya/zhihuishuapi/blob/main/components/main_window.py): `components/main_window.py`
- [Configuration](https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/config.py): `modules/config.py`
- [Logging](https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/logger.py): `modules/logger.py`

### Login and identity

- [Token receiver](https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/auth_http_server.py): `modules/auth_http_server.py`
- [Auth manager](https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/auth.py): `modules/auth.py`
- [Slider verification](https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/slider_verify_async.py): `modules/slider_verify_async.py`

### Course study

- [Course retrieval](https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/List_Retrieval.py): `modules/List_Retrieval.py`
- [Video catalog](https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/videos.py): `modules/videos.py`
- [Batch study queue](https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/Line_up.py): `modules/Line_up.py`
- [Progress reporting](https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/Report_progress.py): `modules/Report_progress.py`

### Web interface and updates

- [Course selection UI](https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/web.py): `modules/web.py`
- [WebSocket server](https://github.com/wangshaoxinya/zhihuishuapi/blob/main/modules/web.py): `modules/web.py`
- [Progress display](https://github.com/wangshaoxinya/zhihuishuapi/blob/main/components/main_window.py): `components/main_window.py`

### Other components

- **User**
- **Zhihuishu login**
- **Token service**
- **Zhihuishu study API**
- **Study progress API**

## Connections

- User → Main window: uses
- Application startup → Main window: opens
- Application startup → Configuration: loads
- Application startup → Logging: logs errors
- Main window → Embedded browser: hosts
- Embedded browser → Zhihuishu login: shows
- Zhihuishu login → Token receiver: posts token
- Token receiver → Auth manager: exchanges token
- Auth manager → Token service: requests token
- Embedded browser → Slider verification: verifies challenge
- Main window → Course retrieval: retrieves courses
- Course retrieval → Zhihuishu study API: requests course data
- Main window → Course selection UI: opens study interface
- Course selection UI → WebSocket server: sends selections
- WebSocket server → Main window: dispatches commands
- Main window → Video catalog: loads videos
- Main window → Batch study queue: starts batch study
- Batch study queue → Progress reporting: reports video progress
- Progress reporting → Study progress API: posts study records
- Main window → Progress display: updates progress
- Progress reporting → Progress display: emits progress
