One docker compose up gives you a REST API, an MCP server and a web console for Douyin, TikTok and Bilibili — 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 (抖音), TikTok and
Bilibili (哔哩哔哩). 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 and comments, sounds, hashtags, live rooms, trending
boards and search results, and it downloads video and image albums without a
watermark — it selects the clean stream the platform already publishes rather
than stripping anything, the clip behind a Douyin live photo included. What it
collects is archived in your own PostgreSQL, so a post deleted upstream is still
readable locally.
A video it has downloaded can be turned into text on the same machine. The
optional transcriber runs FunASR models in a container with no route out, so the
audio never leaves the host and no speech API is called.
It handles the awkward parts rather than leaving them to you: Douyin’s
a_bogus and X-Bogus request signatures, TikTok’s and Bilibili’s WBI 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 126 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
Guest identities are minted on a timer — by a headless browser for Douyin
and TikTok, over plain HTTP for Bilibili. 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, the TikTok signatures and Bilibili’s WBI 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.
More than posts
Beside a post and its author: the posts recommended next to it, a sound and
the posts that use it, hashtags, keyword search, an author’s own series,
live rooms and the trending boards — on each platform that answers a guest
for them.
Download, keep, transcribe
Downloads run in a small Go sidecar and show their progress as they go, and
a multi-part Bilibili video downloads part by part. A finished video can be
transcribed offline — Mandarin, with punctuation, in about a second per
minute of audio on two CPU cores.
?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.