# johnserf-seed/tiktokdownload architecture

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

- Interactive diagram: https://gitdiagram.com/johnserf-seed/tiktokdownload
- Repository: https://github.com/johnserf-seed/tiktokdownload

## Overview

TikTokDownload is a command-line Douyin/TikTok downloader built on the external F2 package, with an auxiliary Flask service for generating request parameters and a GUI directory. The main workflow is choosing a platform, invoking its F2 CLI, and using F2’s documented collection and download capabilities. The README describes broad platform features, but the sampled entry point delegates those workflows to F2; GUI behavior is not established by the excerpts. The Flask routes and their signing helpers are visible in source.

Main entry points: [`Server/Server.py`](https://github.com/johnserf-seed/tiktokdownload/blob/main/Server/Server.py) (Flask parameter API), [`TikTokTool.py`](https://github.com/johnserf-seed/tiktokdownload/blob/main/TikTokTool.py) (Platform CLI launcher), [`Server/x-bogus.js`](https://github.com/johnserf-seed/tiktokdownload/blob/main/Server/x-bogus.js) (X-Bogus generator), [`Server/x-tt-params.js`](https://github.com/johnserf-seed/tiktokdownload/blob/main/Server/x-tt-params.js) (X-TT-Params generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User Interfaces"]
  node_launcher["Platform CLI launcher<br/>[TikTokTool.py]"]
  node_gui["GUI resources<br/>[resource.py]"]
  node_gui_layout["GUI layout<br/>[Main.ui]"]
end

subgraph group_download["Collection and Download"]
  node_f2["F2 platform workflows"]
  node_douyin["Douyin collection and downloads"]
  node_tiktok["TikTok collection and downloads"]
  node_api_user["Douyin user API examples"]
  node_api_posts["Post API examples"]
end

subgraph group_signing["Parameter Service"]
  node_server["Flask parameter API<br/>[Server.py]"]
  node_xbogus["X-Bogus generator<br/>[x-bogus.js]"]
  node_xtt["X-TT-Params generator<br/>[x-tt-params.js]"]
  node_verify_py["Web ID generator &#40;Python&#41;<br/>[s_v_web_id.py]"]
  node_verify_js["Web ID generator &#40;JavaScript&#41;<br/>[s_v_web_id.js]"]
  node_ttwid_service["TTWID registration service"]
end

node_user(("User"))
node_server_user(("API client"))

node_user -->|"selects platform"| node_launcher
node_launcher -->|"dispatches to"| node_f2
node_f2 -->|"provides workflows"| node_douyin
node_f2 -->|"provides workflows"| node_tiktok
node_server_user -->|"requests parameters"| node_server
node_server -->|"calls getXB"| node_xbogus
node_server -->|"calls getXTTP"| node_xtt
node_server -->|"requests cookie"| node_ttwid_service

click node_launcher "https://github.com/johnserf-seed/tiktokdownload/blob/main/TikTokTool.py"
click node_gui "https://github.com/johnserf-seed/tiktokdownload/blob/main/GUI/resource.py"
click node_gui_layout "https://github.com/johnserf-seed/tiktokdownload/blob/main/GUI/Main.ui"
click node_api_user "https://github.com/johnserf-seed/tiktokdownload/blob/main/API/user_profile_info.json"
click node_api_posts "https://github.com/johnserf-seed/tiktokdownload/blob/main/API/user_post_info_video.json"
click node_server "https://github.com/johnserf-seed/tiktokdownload/blob/main/Server/Server.py"
click node_xbogus "https://github.com/johnserf-seed/tiktokdownload/blob/main/Server/x-bogus.js"
click node_xtt "https://github.com/johnserf-seed/tiktokdownload/blob/main/Server/x-tt-params.js"
click node_verify_py "https://github.com/johnserf-seed/tiktokdownload/blob/main/Server/s_v_web_id.py"
click node_verify_js "https://github.com/johnserf-seed/tiktokdownload/blob/main/Server/s_v_web_id.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_launcher,node_gui,node_gui_layout,node_user,node_server_user toneBlue
class node_f2,node_douyin,node_tiktok,node_api_user,node_api_posts toneAmber
class node_server,node_xbogus,node_xtt,node_verify_py,node_verify_js,node_ttwid_service toneMint
```

## Components

### User Interfaces

- [Platform CLI launcher](https://github.com/johnserf-seed/tiktokdownload/blob/main/TikTokTool.py): `TikTokTool.py`
- [GUI resources](https://github.com/johnserf-seed/tiktokdownload/blob/main/GUI/resource.py): `GUI/resource.py`
- [GUI layout](https://github.com/johnserf-seed/tiktokdownload/blob/main/GUI/Main.ui): `GUI/Main.ui`

### Collection and Download

- **F2 platform workflows**
- **Douyin collection and downloads**
- **TikTok collection and downloads**
- [Douyin user API examples](https://github.com/johnserf-seed/tiktokdownload/blob/main/API/user_profile_info.json): `API/user_profile_info.json`
- [Post API examples](https://github.com/johnserf-seed/tiktokdownload/blob/main/API/user_post_info_video.json): `API/user_post_info_video.json`

### Parameter Service

- [Flask parameter API](https://github.com/johnserf-seed/tiktokdownload/blob/main/Server/Server.py): `Server/Server.py`
- [X-Bogus generator](https://github.com/johnserf-seed/tiktokdownload/blob/main/Server/x-bogus.js): `Server/x-bogus.js`
- [X-TT-Params generator](https://github.com/johnserf-seed/tiktokdownload/blob/main/Server/x-tt-params.js): `Server/x-tt-params.js`
- [Web ID generator (Python)](https://github.com/johnserf-seed/tiktokdownload/blob/main/Server/s_v_web_id.py): `Server/s_v_web_id.py`
- [Web ID generator (JavaScript)](https://github.com/johnserf-seed/tiktokdownload/blob/main/Server/s_v_web_id.js): `Server/s_v_web_id.js`
- **TTWID registration service**

### Other components

- **User**
- **API client**

## Connections

- User → Platform CLI launcher: selects platform (evidence: `TikTokTool.py`)
- Platform CLI launcher → F2 platform workflows: dispatches to (evidence: `TikTokTool.py`)
- F2 platform workflows → Douyin collection and downloads: provides workflows (evidence: `README.md`)
- F2 platform workflows → TikTok collection and downloads: provides workflows (evidence: `README.md`)
- API client → Flask parameter API: requests parameters (evidence: `Server/Server.py`)
- Flask parameter API → X-Bogus generator: calls getXB (evidence: `Server/Server.py`)
- Flask parameter API → X-TT-Params generator: calls getXTTP (evidence: `Server/Server.py`)
- Flask parameter API → TTWID registration service: requests cookie (evidence: `Server/Server.py`)
