How evil0ctal/douyin_tiktok_download_api works
DTK is a self-hosted Douyin/TikTok data API with a web console and MCP interface. A typical request enters through an API or console, becomes asynchronous work when queued, and is executed by the worker through platform-specific fetching, identity selection and scheduling; results and operational records are kept in PostgreSQL. The repository also includes identity minting, archive/watchlist operations, and browser and media sidecars. Several links below are documented or referenced by the source index; unsampled runtime wiring is omitted or marked unverified.
Main entry points: fetch.py Fetch service · pool.py Identity pool · api REST API · tasks.py Task queue
Components 19
User interfaces
- Web console
web/src - REST API
src/dtk/api - MCP server
src/dtk/mcp - Task endpoints
src/dtk/api/routes/tasks.py
Fetch execution
- Task queue
src/dtk/services/tasks.py - Task worker
src/dtk/worker/main.py - Fetch service
src/dtk/services/fetch.py - Direct probe pipeline
src/dtk/ops/pipeline.py - Platform adapters
src/dtk/platforms
Identity and scheduling
- Identity pool
src/dtk/identity/pool.py - Request scheduler
src/dtk/scheduler/scheduler.py
State and operations
- PostgreSQL data
src/dtk/db/models.py - Data repositories
src/dtk/db/repositories.py - Archive services
src/dtk/services/archive.py - Watchlist services
src/dtk/services/watchlist.py
Sidecar integrations
- Browser RPC
docker/browser_rpc/main.py - Media downloader
docker/downloader
Other components
- API client
- Douyin / TikTok
Connections 20
- API client → REST API: sends requests
README.md - Web console → REST API: calls API
README.md - REST API → Task endpoints: routes tasks
src/dtk/api/app.py - Task endpoints → Task queue: submits and collects
src/dtk/api/routes/tasks.py - Task queue → PostgreSQL data: stores task state
src/dtk/services/tasks.py - Task worker → Task queue: claims and finishes
src/dtk/worker/main.py - Task worker → Fetch service: runs fetch
src/dtk/worker/main.py - Fetch service → Identity pool: selects identities
src/dtk/services/fetch.py - Fetch service → Request scheduler: requests leases
src/dtk/services/fetch.py - Fetch service → Platform adapters: dispatches requests
src/dtk/services/fetch.py - Platform adapters → Douyin / TikTok: fetches platform data
README.md - Identity pool → PostgreSQL data: reads identity records
src/dtk/identity/pool.py - Identity pool → Browser RPC: mints identities
- Direct probe pipeline → Identity pool: selects identity
src/dtk/ops/pipeline.py - Direct probe pipeline → Platform adapters: uses platform registry
src/dtk/ops/pipeline.py - Data repositories → PostgreSQL data: reads and writes
- Archive services → Data repositories: uses persistence
- Watchlist services → Data repositories: uses persistence
- MCP server → API client: serves tool requests
README.md - Media downloader → Douyin / TikTok: downloads media
README.md