One docker compose up gives you a REST API, an MCP server and a web console for Douyin and TikTok — on your own machine, with an identity pool that maintains itself.
Douyin_TikTok_Download_API is an open-source, self-hosted data API for
Douyin (抖音) and TikTok. You run it
on your own machine with one docker compose up. There is no hosted tier, no
signup and no quota, and nothing is proxied through anybody else’s server.
It fetches posts, authors, comments, mixes and search from both platforms, and it
downloads video and image albums without a watermark — it selects the clean
stream the platform already publishes rather than stripping anything. What it
collects is archived in your own PostgreSQL, so a post deleted upstream is still
readable locally.
It handles the awkward parts rather than leaving them to you: Douyin’s
a_bogus and X-Bogus request signatures and TikTok’s are implemented natively
in Python, short links are expanded and checked against an allowlist before
anything is fetched, and a post id is validated against the platform’s own
encoding so an id that cannot exist never costs an upstream request.
Three entry points, one service layer
A REST API with 93 operations, an MCP server for AI agents, and a dtk CLI.
MCP is not a wrapper around HTTP: all three call the same service layer, so
a tool call skips the second hop and the second authentication.
Cookies stop being a chore
A headless browser mints guest identities on a timer. The pool tests, cools
and retires them on its own. Your own logged-in cookies are an optional
upgrade, not a requirement.
Signing is native Python
a_bogus, X-Bogus and the TikTok signatures run in-process in
microseconds. The browser stays as a fallback and as a drift detector — it
is how the instance notices the platform changed its algorithm.
It tells you when it is unwell
Every request is logged with structure. Every identity and every endpoint
carries a live health score. Risk-control signals trip a circuit breaker
before the pool burns down.
?wait=25 is what makes the call synchronous: it holds the connection until the
task finishes and answers 200 with the result. Leave it off and you get 202
with a task id instead, which is the normal asynchronous path. The ceiling on
this instance is 30 seconds.
TikHub pays to be on this page, and this project stays free and Apache-2.0
because of it. That is the whole arrangement: no paid tier here, no feature held
back, nothing that stops working if you never click it.
Open http://localhost:8000 and finish the setup in the browser.
The long version is in the quick start.
A bash script that works out your distribution, offers the right way to
install Docker, scales the container limits to the machine, generates
secrets and brings the stack up. Run it again afterwards and it becomes the
operations menu: status, upgrade, passwords, backups, settings, disk.