# qitoqito/psyduck architecture

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

- Interactive diagram: https://gitdiagram.com/qitoqito/psyduck
- Repository: https://github.com/qitoqito/psyduck

## Overview

PsyDuck is a configurable JD activity-task runner for Qinglong. A user invokes a task through `main.js`; it dynamically loads the matching parser task and initializes it with command-line parameters. The README documents account selection, timing, concurrency, caching, proxy options, and notifications as framework capabilities. The source excerpts confirm task dispatch, Qinglong management, and file decryption, but do not show how task implementations connect to most shared utilities or integrations; those links are therefore omitted.

Main entry points: [`util/common.js`](https://github.com/qitoqito/psyduck/blob/main/util/common.js) (Common utilities), [`qlCreate.js`](https://github.com/qitoqito/psyduck/blob/main/qlCreate.js) (Qinglong manager), [`main.js`](https://github.com/qitoqito/psyduck/blob/main/main.js) (Task entry), [`parse/jd`](https://github.com/qitoqito/psyduck/tree/main/parse/jd) (Activity tasks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_execution["Task execution"]
  node_runner["Task entry<br/>[main.js]"]
  node_profile["Profiles<br/>[profile.js]"]
end

subgraph group_activities["JD activities"]
  node_task_scripts["Activity tasks"]
end

subgraph group_platform["Framework services"]
  node_common["Common utilities<br/>[common.js]"]
  node_relay["Relay proxy<br/>[relayProxy.js]"]
  node_user_agent["User agents<br/>[userAgent.js]"]
  node_jd_algo["JD algorithms<br/>[jdAlgo.js]"]
  node_h5st["H5ST signing<br/>[5.2.6.js]"]
  node_cache["Account cache<br/>[cache.js]"]
  node_notifications["Notifications<br/>[message.js]"]
end

subgraph group_operations["Qinglong management"]
  node_file_crypto["File decryption<br/>[fileCrypto.js]"]
  node_ql_create["Qinglong manager<br/>[qlCreate.js]"]
end

node_user(("Operator"))
node_qinglong(("Qinglong panel"))
node_redis[("Redis cache")]
node_jd_service(("JD services"))

node_user -->|"runs task"| node_runner
node_runner -->|"loads task"| node_task_scripts
node_common -->|"imports"| node_relay
node_common -->|"imports"| node_user_agent
node_ql_create -->|"decrypts files"| node_file_crypto
node_ql_create -->|"manages tasks"| node_qinglong
node_task_scripts -.->|"runs activities"| node_jd_service
node_cache -.->|"stores cache"| node_redis

click node_runner "https://github.com/qitoqito/psyduck/blob/main/main.js"
click node_task_scripts "https://github.com/qitoqito/psyduck/tree/main/parse/jd"
click node_profile "https://github.com/qitoqito/psyduck/blob/main/config/profile.js"
click node_common "https://github.com/qitoqito/psyduck/blob/main/util/common.js"
click node_relay "https://github.com/qitoqito/psyduck/blob/main/util/relayProxy.js"
click node_user_agent "https://github.com/qitoqito/psyduck/blob/main/util/userAgent.js"
click node_jd_algo "https://github.com/qitoqito/psyduck/blob/main/util/jdAlgo.js"
click node_h5st "https://github.com/qitoqito/psyduck/blob/main/static/h5st/5.2.6.js"
click node_cache "https://github.com/qitoqito/psyduck/blob/main/util/cache.js"
click node_notifications "https://github.com/qitoqito/psyduck/blob/main/util/message.js"
click node_file_crypto "https://github.com/qitoqito/psyduck/blob/main/fileCrypto.js"
click node_ql_create "https://github.com/qitoqito/psyduck/blob/main/qlCreate.js"

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_runner,node_profile toneBlue
class node_task_scripts,node_redis toneAmber
class node_common,node_relay,node_user_agent,node_jd_algo,node_h5st,node_cache,node_notifications toneMint
class node_file_crypto,node_ql_create toneRose
class node_user,node_qinglong,node_jd_service toneIndigo
```

## Components

### Task execution

- [Task entry](https://github.com/qitoqito/psyduck/blob/main/main.js): `main.js`
- [Profiles](https://github.com/qitoqito/psyduck/blob/main/config/profile.js): `config/profile.js`

### JD activities

- [Activity tasks](https://github.com/qitoqito/psyduck/tree/main/parse/jd): `parse/jd`

### Framework services

- [Common utilities](https://github.com/qitoqito/psyduck/blob/main/util/common.js): `util/common.js`
- [Relay proxy](https://github.com/qitoqito/psyduck/blob/main/util/relayProxy.js): `util/relayProxy.js`
- [User agents](https://github.com/qitoqito/psyduck/blob/main/util/userAgent.js): `util/userAgent.js`
- [JD algorithms](https://github.com/qitoqito/psyduck/blob/main/util/jdAlgo.js): `util/jdAlgo.js`
- [H5ST signing](https://github.com/qitoqito/psyduck/blob/main/static/h5st/5.2.6.js): `static/h5st/5.2.6.js`
- [Account cache](https://github.com/qitoqito/psyduck/blob/main/util/cache.js): `util/cache.js`
- [Notifications](https://github.com/qitoqito/psyduck/blob/main/util/message.js): `util/message.js`

### Qinglong management

- [File decryption](https://github.com/qitoqito/psyduck/blob/main/fileCrypto.js): `fileCrypto.js`
- [Qinglong manager](https://github.com/qitoqito/psyduck/blob/main/qlCreate.js): `qlCreate.js`

### Other components

- **Operator**
- **Qinglong panel**
- **Redis cache**
- **JD services**

## Connections

- Operator → Task entry: runs task
- Task entry → Activity tasks: loads task (evidence: `main.js`)
- Common utilities → Relay proxy: imports (evidence: `util/common.js`)
- Common utilities → User agents: imports (evidence: `util/common.js`)
- Qinglong manager → File decryption: decrypts files (evidence: `qlCreate.js`)
- Qinglong manager → Qinglong panel: manages tasks (evidence: `qlCreate.js`)
- Activity tasks → JD services: runs activities
- Account cache → Redis cache: stores cache
