DTK — Self-hosted Douyin, TikTok & Bilibili Data API
Self-hosted scraper and watermark-free downloader for Douyin, TikTok and Bilibili, callable by AI agents over MCP.
- Source repo
- Evil0ctal/Douyin_TikTok_Download_API
- Stars
- ★ 22k
- Last updated
- 4d ago
- FARS reviewed
- Dec 04, 2026
- License
- Apache-2.0
- Primary language
- Python
- FA score
- 55/100 · Major gaps
At a glance
- How it runs
- Works with
- Universal · cross-platformCodex · Claude CodeClaude.ai (Partial support)
- Cost
- Free, no paid service needed
- Setup effort
- Medium · a few setup steps
- You'll need
- Typical use
- Research teams that need a durable corpus of Douyin, TikTok and Bilibili posts and comments, including posts later deleted upstream.
- Not a fit if
- Teams that need a managed service with an SLA — the public demo is read-only and may be reset or switched off unannounced.
- Users who cannot run PostgreSQL with TimescaleDB plus Redis themselves; Docker Compose is the supported path.
- Projects that need non-Mandarin transcription — the bundled FunASR models target Mandarin.
- Website
- douyin.wtf ↗ set on GitHub
- Maintenance
- Commits in the last 30 dayslast commit 2026-12-01
- Source review
- 55/100 · Major gaps
What does this agent do, and when should you use it?
DTK (repository name Douyin_TikTok_Download_API) is a self-hosted service that turns Douyin, TikTok and Bilibili links into one normalised data model — posts, authors, comments, sounds, hashtags, live rooms, trending boards and search results — and downloads video and image albums without a watermark. One docker compose up brings up the whole stack: a Python 3.12/FastAPI REST API with 128 operations, an MCP server at /mcp, a dtk CLI, and a React console for the identity pool, scheduler, library, downloads, logs and diagnostics. Identities are minted by a separate headless CloakBrowser container for Douyin and TikTok, or over plain HTTP for Bilibili, and the scheduler rotates them through health tiers, token buckets and per-endpoint circuit breakers. Everything parsed is archived in your own PostgreSQL (with TimescaleDB) plus Redis, so a post deleted upstream is still there. Requests are asynchronous by default (202 plus a task_id, with ?wait= for synchronous calls), a Go sidecar handles media downloads and an offline FunASR sidecar handles transcription, and all access goes through scoped API keys — no signup, no quota.
Input can be a short link, a post URL, a Bilibili BV/av number, or the whole share caption an app puts on your clipboard: src/dtk/urls extracts and expands links and validates post ids against the platform's own encoding before any upstream call. The three adapters under src/dtk/platforms define each platform's endpoints and parsers; src/dtk/signing implements a_bogus, X-Bogus, X-Gnarly, X-Dynosaur and Bilibili's WBI in pure Python, with a browser fallback. src/dtk/scheduler picks an identity from the pool and sends the request through health tiers, quantised LRU rotation, one in-flight lock per identity, a token bucket per (identity, endpoint) and a circuit breaker per endpoint, while the transport layer classifies responses. Results are written to the PostgreSQL archive with counter snapshots, and the worker runs scheduled collection and callbacks. Four entry points share one service layer: REST (/api/v1/..., 128 operations), MCP (/mcp, ten tools — parse_url, get_video, get_user, list_user_posts, list_comments, get_content_history, pool_status, download_media, transcribe_video, get_task_result), the dtk CLI, and the React console with Swagger at /docs. The downloader sidecar stores media on local disk; the transcriber sidecar runs FunASR ONNX models (Paraformer, FSMN-VAD, CT-Transformer) in a container with no network route and turns a stored video into text.
- Research teams that need a durable corpus of Douyin, TikTok and Bilibili posts and comments, including posts later deleted upstream.
- Agent developers who want Claude Code or Codex CLI to parse a link, store the media and transcribe it over MCP without writing scraping code.
- Social-media analysts who re-collect a post or an author on a timer to build counter histories from the local archive.
- Content operations teams downloading watermark-free videos and image albums in bulk by author, skipping what is already downloaded and cleaning up duplicates.
- Privacy-conscious self-hosters who refuse to hand login cookies to a third-party SaaS and need their own identity pool, API keys and roles.
- Live and trend monitoring: check whether a room is on air and get its pull URLs, or pull Bilibili's hot, weekly and top-100 boards.
Key setup facts
Pulled from the install and usage notes below. The project README has the current values.
- Ports
8000- Environment variables
POSTGRES_PASSWORDREDIS_PASSWORDDTK_SECRET_KEYDTK_DATABASE_URLDTK_REDIS_URL- Config files
.envdocker/compose.yml- Runtime
- Python 3.12 · Node.js 22
- Install notes cover
- Docker
How do you install or deploy this agent?
Docker Compose is the recommended path. Clone the repository (the default branch is v5):
git clone https://github.com/Evil0ctal/Douyin_TikTok_Download_API.git
cd Douyin_TikTok_Download_APINothing in the repository ships a default password or key, so write .env first:
POSTGRES_PASSWORD=$(openssl rand -hex 24)
REDIS_PASSWORD=$(openssl rand -hex 24)
cat > .env <<EOF
DTK_SECRET_KEY=$(openssl rand -base64 48)
POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
REDIS_PASSWORD=${REDIS_PASSWORD}
DTK_DATABASE_URL=postgresql+asyncpg://dtk:${POSTGRES_PASSWORD}@postgres:5432/dtk
DTK_REDIS_URL=redis://:${REDIS_PASSWORD}@redis:6379/0
EOFStart the stack and read the setup token from the API log:
docker compose -p dtk -f docker/compose.yml up -d
docker compose -p dtk -f docker/compose.yml logs apiOpen http://127.0.0.1:8000 and use that token to create the first administrator. No browser container starts by default, so without --profile browser Douyin and TikTok identities can only be imported, not minted; the downloader and transcriber sidecars are optional profiles too. There is also a guided installer that detects Docker, sizes the resource limits to the machine, and later doubles as the operations menu:
curl -fsSL https://raw.githubusercontent.com/Evil0ctal/Douyin_TikTok_Download_API/main/install/install.sh -o install.sh
less install.sh
bash install.shWithout Docker you must supply PostgreSQL 17 with the TimescaleDB extension (a plain postgres:17 will not do), Redis 8, Python 3.12 and uv, plus Node 22 to build the console.
How do you use this agent?
Create an API key in the console's API keys page (keys carry scopes and roles), then point any streamable-http MCP client at /mcp. With Claude Code:
claude mcp add --transport http dtk http://127.0.0.1:8000/mcp/ \
--header "Authorization: Bearer dtk_YOUR_API_KEY"The agent can then call parse_url on a link, page through list_comments, store media with download_media and turn it into text with transcribe_video. The REST reference is generated from the code that serves the requests, so your own instance is the current copy: /docs inside the console, or /swagger, /redoc and /openapi.json without a login. The CLI runs over the same service layer:
dtk --helpTo try it before installing anything, sign in to the read-only instance at https://demo.douyin.wtf — the login page fills in the demo account and an API key is shown in plaintext on the keys page. It is rate limited to 30 requests per 10 seconds, with a 10-second cooldown after that.
Safety boundaries, hardening & integrations
Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.
Declared capability surface (blast radius)
Can run terminal commands; pair with approval gates or container/OS sandboxing.
Modifies local files; work on a clean Git branch or dedicated worktree.
Makes outbound requests; verify telemetry settings and model data routing on private repos.
Inherits capabilities of connected MCP servers; audit third-party servers before enabling.
What are this agent's strengths and limitations?
- A self-healing identity pool: a headless browser mints guest identities and tops the pool up when usable ones run low, while the scheduler applies health tiers, token buckets and per-endpoint circuit breakers — replacing v4's hand-copied cookies in
config.yaml. - One service layer behind four surfaces — REST (128 operations), MCP (10 tools), a CLI and a React console — guarded by API keys with scopes and roles.
- Signing is pure Python (a_bogus, X-Bogus, X-Gnarly, X-Dynosaur and Bilibili WBI) with a browser fallback only when needed; Bilibili guests are minted over plain HTTP, so its pool needs no browser container.
- Everything parsed is archived in PostgreSQL + Redis with counter snapshots, so upstream deletions remain queryable, and an author or post can be re-collected on a timer.
- Offline transcription: FunASR ONNX models run in a container with no outbound route, audio never leaves the host, and a 3 min 13 s clip took 3.7 seconds on two CPU cores — no GPU.
- Apache-2.0, explicitly allowing commercial and closed-source use as long as the licence and NOTICE travel with copies and modifications are stated.
- Heavy runtime dependencies: PostgreSQL 17 with the TimescaleDB extension plus Redis 8; a plain
postgres:17is not supported. - Real platform gaps: Douyin offers no follower/following lists, no posts under a hashtag and no keyword search, and guest identities also cap things like Douyin liked posts and Bilibili comment threads — filling those needs an imported logged-in cookie, with a ban risk the author says cannot be ruled out.
- A default install mints no Douyin or TikTok identities; that needs the
browserprofile, whose image is never pulled but built locally from a pinned commit, so every update means a rebuild. - Transcription targets Mandarin only, is off by default, and requires downloading and SHA-256-checking roughly 500 MB of models.
- The public demo is read-only, capped at 30 requests per 10 seconds, and may be reset or switched off without notice — not a service to build on.
- v4 to v5 is a rewrite with an incompatible API shape, and database migrations have no automatic downgrade: rolling back means reinstalling the old version over a pre-upgrade backup.
How does this agent compare with similar options?
The README contrasts v5 with the project's own v4 branch, still published as image V4.1.2: v4 pastes cookies into config.yaml, calls synchronously, keeps no archive and has no API keys, and its baked-in Douyin cookie has long expired, so Douyin endpoints answer 400 until you mount your own. Stay on v4 only if you need the old API shape. The README also names its sponsor TikHub.io, a commercial social-data API marketplace covering Douyin, Xiaohongshu, TikTok, Instagram, YouTube and more — the option for teams that would rather buy data access by the call than operate this stack.
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| DTK — Self-hosted Douyin, TikTok & Bilibili Data API This agent | 55 · Major gaps | Self-hosted serviceFree | ★ 22k | 4d ago | Python | Codex · Claude Code |
| WeLink | 71 · Some gaps | Self-hosted serviceFree + model costs | ★ 339 | 19d ago | TypeScript | Codex · Claude Code · OpenAI API · Claude API |
| WhoDB | 54 · Major gaps | Self-hosted serviceFreemium | ★ 5.1k | today | Go | — |
| Nocturne Memory: Long-Term Memory Server for MCP Agents | 63 · Some gaps | MCP serverFree | ★ 1.4k | 1mo ago | Python | — |
How does FollowAgents rate this agent?
Why each dimension lost points
trust: SECURITY.md asserts non-root containers, read-only rootfs, dropped capabilities, internal-only Postgres/Redis network, credential encryption with the instance key, scoped API keys and a demo<viewer<operator<admin role ladder, and no default secrets (refuses to start without DTK_SECRET_KEY) — strong least-privilege claims, but they are documentation assertions; the compose file and auth implementation are not in the packet, so least_privilege is 2 not 3. browser_rpc/main.py openly states its three endpoints have no authentication and rely on the internal compose network — a deliberate trust-boundary choice but still a permission-surface weakness. user_confirmation is 1: no confirmation gate is shown for side-effecting operations (download, archive, transcribe) at the MCP tool layer, and the README does not describe one. data_flow_transparency is 2: README explains local PostgreSQL storage, offline transcription in a no-route sidecar, and that audio never leaves the host, but no full data-flow diagram. sensitive_data_handling is 2: credential encryption, read-only demo, and warnings about importing logged-in cookies are present, but handling detail is deferred to docs. dependency_security is 2: dependencies have lower bounds, CI runs CodeQL (security-extended) plus ruff/mypy, and CloakBrowser is pinned to a commit as a security control, but no lockfile or dependency-vulnerability scanning evidence is shown. external_effects is 1: scraping, downloading, archiving and transcription all have external effects, yet the README does not systematically state irreversibility or upstream impact bounds. rollback is 1: the installer mentions backup/restore and uninstall, but no fine-grained rollback for data writes or downloads. source_attribution is 1: README credits the author and lists sponsors/REER, but third-party code and signing-algorithm provenance are not systematically attributed; publisher identity is unverified.
reliability: self_consistency is 2 — the v4/v5 comparison, capability matrix, MCP tool table and pyproject version 5.1.13 agree, CI covers lint/type/unit/integration/console/image, and contract tests are explicitly non-gating with a stated reason; coherent, though the packet sample is limited. dependency_availability is 2 — dependencies are public PyPI packages with lower bounds and CI uses uv sync --all-extras with pinned service images (timescaledb pg17, redis:8-alpine), but no uv.lock or hash-pinning evidence. failure_messages is 2 — browser_rpc/__main__.py reports config errors as one readable line before binding and returns EX_CONFIG, tests verify actionable messages for a missing library (CLOAKBROWSER_COMMIT, DTK_BROWSER_BACKEND=fake), and the health endpoint returns structured status even on failure; good but only for some components.
adaptability: audience_and_scenarios is 2 — README clearly targets self-hosters, AI agents (MCP clients such as Claude Code/Desktop, Codex CLI, Cherry Studio), developers and operators, with concrete scenarios (scrape, download, archive, transcribe, live). capability_boundaries is 2 — the per-platform capability matrix marks support and explains gaps (Douyin follower lists need login, TikTok post search refuses guests), and MCP tools are deliberately kept to ten with a rationale. trigger_precision is 1 — tool selection is left to the agent; the README only says fewer tools help agents choose, with no trigger conditions, parameter constraints or disambiguation guidance, and link-recognition rules are described but not tool-trigger precision. environment_fit is 2 — one-command Docker Compose, bare-metal install, mainland-China mirror note, Python 3.12–3.13 constraint and machine-scaled resource limits are well covered.
convention: information_architecture is 2 — README is well structured (capabilities, MCP, transcription, links, stack, layout, quick start), documents hold 18 bilingual pages, and the project layout is detailed. install_notes is 2 — guided script plus manual Docker route, v4 migration notes, port separation (8000 vs 8080) and config-mount caveats are covered. naming_stability is 2 — the dtk abbreviation, DTK_ env prefix, package name and command are consistent. examples_and_faq is 2 — MCP registration command, link examples, demo instance and rate-limit notes are present; an explicit FAQ is not visible in the sample but docs pages likely cover it. known_limitations is 2 — unsupported platform features, Mandarin-only transcription quality, no v4→v5 upgrade path and demo instability are stated. license is 3 — full Apache-2.0 text in LICENSE matches the pyproject declaration. versioning_changelog is 2 — version 5.1.13, references to v5.1.6 and v5.0.0 release notes and the v4 freeze policy support versioning, but no CHANGELOG file is in the packet. maintenance_responsibility is 1 — SECURITY.md states single-maintainer status, supported versions and response time, but publisher identity is unverified and responsibility rests on self-description.
effectiveness: output_usability is 2 — normalized REST results, async 202+task_id with ?wait= sync mode, structured MCP tool returns and .txt transcription export are usable, though no concrete response schema sample is shown. marginal_value is 2 — self-healing identity pool, scheduler, archive, offline transcription and MCP integration add clear value over calling platforms directly or v4, but similar open-source projects exist and differentiation is mainly execution quality. cost_benefit is 1 — requires PostgreSQL+TimescaleDB, Redis, a browser sidecar, a Go downloader and a transcription sidecar (multiple containers, ~500MB models), a high operational cost with no quantified resource footprint or comparison to alternatives.
verifiability: claim_traceability is 1 — many performance and behavior claims (3.7s transcription of a 3m13s clip, 30 req/10s limit, platform measurement dated 2026-11-02) lack reproducible methodology or data-source links; some point to doc pages not included in the sample. cross_source_corroboration is 1 — README, SECURITY.md, pyproject and CI broadly agree on version, dependencies and security claims, but key security assertions (non-root, read-only rootfs, encryption) have no compose or code corroboration in the packet. fact_inference_separation is 1 — README blends design intent ("self-healing", "few tools on purpose") with measured facts without clearly separating verified fact from inference; test comments with measurement dates are a rare good example.
- The three browser_rpc endpoints have no authentication and rely solely on internal compose network isolation; any network misconfiguration or exposed port widens the attack surface.
- MCP tools can trigger write operations (download, archive, transcribe) with no visible user-confirmation gate, so agent misuse may cause unintended side effects.
- Performance, rate-limit and platform-measurement claims in the README lack reproducible methodology and cannot be verified by static review.
- Publisher identity is unverified; maintenance responsibility and update path rest on self-description, and no lockfile or dependency-vulnerability scanning evidence is present.
- Importing logged-in cookies carries account-ban risk; the README warns of this but the risk is borne by the user.
FAQ
Does it need a paid service or an external LLM?
What can an agent do over MCP, and how is that bounded?
Why are some things missing on Douyin?
Can it run without Docker?
How do updates and rollbacks work?
./dtkctl upgrade (or ./dtkctl upgrade 5.1.6 for a specific release) moves the checkout to the tag, pulls or rebuilds images, rebuilds the browser image, takes a backup, migrates, then writes the version and restarts; anything failing before the restart is rolled back. Migrations have no automatic downgrade, so the script refuses a release missing the database's latest migration — past that point the only way back is a fresh install of the old version with a pre-upgrade backup restored.Thanks — we use this to improve the page.
Subscribe to the FollowAgents RSS feed, or save this agent to your browser shortlist to compare on your next visit.