Skip to content
douyin

Introduction

How douyin-cli is put together.

douyin is a single Go binary built on the any-cli/kit framework. It reads Douyin (抖音), ByteDance's Chinese short-video platform, through its public web surfaces and prints clean structured records you can pipe into your tools. No API key, no login.

douyin reading the hot-search board into a table and piping it through jq

Read operations, three ways

The read operations are defined once and exposed three ways:

  • on the CLI, as douyin hot, douyin video, douyin user, douyin posts, douyin comments, and douyin search;
  • over HTTP, with douyin serve (NDJSON responses; endpoints include /healthz and /v1/openapi.json);
  • over MCP, with douyin mcp (an MCP server over stdio).

The same code answers all three, so a record you get on the CLI is the same record you get over HTTP or MCP.

Surfaces

  • hot reads the hot-search billboard, in rank order, across the realtime, video, music, and star tabs.
  • video reads one video record from the signed aweme/detail endpoint.
  • user reads a public profile, addressed by sec_uid.
  • posts reads a user's public videos, paging the aweme/post endpoint.
  • comments reads comments under a video from the comment/list endpoint.
  • search reads mixed video and user hits from the general search endpoint.

The signed surfaces call the same www.douyin.com/aweme/v1/web/* endpoints the Douyin web page's own JavaScript calls, with a reimplemented a_bogus signature and a fresh msToken, the way a logged-out browser signs them.

Output

Every read command returns records. At a terminal the default format is a table; piped, it is JSONL. Pass -o json, -o csv, -o tsv, -o url, -o markdown, or -o raw to change format explicitly, and --fields or --template to shape what each record shows.

Open and walled

Douyin does not serve every surface the same way to every IP, and the tool is honest about it:

  • hot (the realtime word billboard) is open from any IP, no key. A single anonymous GET returns the real trending phrases with their hot values.
  • The other billboard tabs (video, music, star) and the signed surfaces (video, user, posts, comments, search) are anti-bot-walled from non-China and datacenter IPs. The signed endpoints return an empty body on an HTTP 200, and the web pages return an __ac JavaScript challenge shell. The command recognises each block signal and exits 4 (needs auth) with a hint that the surface needs a residential session, rather than printing nothing as if it were a result.

The endpoints, request shapes, and parsers are correct; they serve fully from a China IP or a warm browser session. The wall is at the IP, region, and JavaScript-challenge layer, not in the code, so no key or token the client could send opens it. The tool never fakes data and never crashes on a wall.

Not affiliated

douyin-cli is an independent tool and is not affiliated with, authorized, or endorsed by ByteDance or Douyin.