Answers
What is Douyin's a_bogus parameter, and do I need to generate it to get Douyin data?
Short answer
a_bogus is a signature Douyin's web client adds to API requests, computed by obfuscated JavaScript from the request and browser details; without a valid one, requests fail or come back empty. You only need it if you call Douyin's web API yourself: through okdata you get the same public data with an API key, at $0.02 per search page and $0.002 per comment page.
If you have opened the network tab on douyin.com, you have seen it: every request to Douyin's web API carries an a_bogus= parameter, a long string that changes on each call. Copy a request without it, or with a stale one, and you get an empty body or a "request params" error. That is why "how is a_bogus generated?" is one of the most common questions in Douyin scraper projects.
What it is
a_bogus is a request signature. Douyin's security script, heavily obfuscated JavaScript loaded by the page, computes it from the query string and body, the browser's user agent and environment, and the time. Its predecessor was X-Bogus. It travels with other tokens: msToken, the ttwid cookie and verifyFp/s_v_web_id. The server checks them together, so a correct signature with a bad cookie still fails.
How people generate it
- Run Douyin's own script. Extract the JavaScript and execute it in Node, often through Python's execjs. Accurate while it lasts, but a script update or a missing browser object breaks it.
- Port the algorithm. Reimplement it in Python or Go by reading the deobfuscated code. Fast at runtime, but every algorithm change means reverse-engineering again.
- Let a real browser sign. Drive Chromium with Playwright and let the page make the requests. The most robust, and the slowest and heaviest; it also brings captchas into play.
All three share a schedule you do not control: when Douyin ships a new version, signers stop working until someone repairs them.
When you can skip it
You need a_bogus only if your code talks to Douyin's web API directly. If you need public data, search results, video details, comments, account videos, an API that maintains signing on its side removes the problem. With okdata these are ordinary HTTPS calls:
| What | Endpoint | Price |
|---|---|---|
| Keyword search | video search | $0.02 per page of about 20 |
| One video | video detail | $0.002 |
| Comments | video comments | $0.002 per page |
| An account's videos | account videos | $0.002 per page |
The same request, no signature
curl -G "https://api.okdata.online/v1/douyin/videos/search" \
-H "Authorization: Bearer $OKDATA_API_KEY" \
--data-urlencode 'query=露营装备' \
--data-urlencode 'sort=latest'
If an upstream change does break an endpoint, you get upstream_failed, not charged and marked retryable, instead of a silent empty list. See the errors page.
When you do need it
Anything done as a user, such as liking, commenting, reading your own favorites or private data, needs your own signed, logged-in session, and so do parameters the catalog does not expose. Open-source projects like TikTokDownloader, Douyin_TikTok_Download_API and MediaCrawler track the algorithm closely and are the best place to follow changes. For research workflows built on public data, see content research.
Updated