This is the Douyin search orchestration interface in the workflow. It only uses the host's already installed and already logged-in OpenCLI, and does not include its own crawler, browser, cookie copying, independent profile, or Python runtime.
Input
query: required, the search keyword.limit: optional, 1-30, default 10.episode: optional, this episode'sepisodes/<slug>path; only writing to00-抖音搜索证据.jsonand.mdis allowed, and writing to candidates, source-health, or00-选题.*。
Execution
1. Precheck
opencli doctor
opencli douyin whoami -f json
Execute the search when Browser Bridge is connectable and logged_in=true . If any precheck fails, in episode mode still write out UNAVAILABLE evidence and the original error for ① to continue judging; for an independent search request, truthfully report that it is currently unavailable. Do not extract or copy Chrome cookies, and do not install new tools.
2. Search
In episode mode, use the deterministic wrapper to execute 1-3 shortlist queries at a time and atomically write JSON/Markdown:
node ~/Documents/laohan-skills/laohan-douyinsousuo/scripts/search-evidence.mjs \
--episode episodes/<slug> \
--query "关键词一" \
--query "关键词二" \
--limit 10
An independent single query can be executed directly:
opencli douyin search "$QUERY" --limit "$LIMIT" -f json
The result must be a JSON array, and must preserve item by item the rank、desc、author、url、aweme_id, publish time, and available interaction fields returned by OpenCLI. For stable id, prioritize using aweme_id or the /video/<id>in the URL; only when neither is present use sha256(url + desc)[:12]. Ranking must not participate in the stable id; do not reorder by missing fields, and do not describe OpenCLI's result order as "ranked by likes".
3. Failure degradation
Execute in order, and stop as soon as one succeeds:
- Add
--trace retain-on-failureto the same command, and use OpenCLI autofix to repair the existing adapter; a maximum of 3 attempts in total. - If
opencli doctoris still normal but the adapter continues to fail, useopencli browser douyin-search bindto bind to the user's currently logged-in Douyin tab, and only perform reading and evidence collection. Before executing the browser degradation, explain that it will operate on the current tab. - If it still fails, record the failure layer and the original error. In episode mode, mark the platform data
UNAVAILABLEand return the evidence file, and do not escalate it to a blocker for ①; for an independent search request, report that no results were obtained this time. Do not temporarily install DrissionPage, Playwright, a browser, or a self-made crawler.
Output and judgment
First show the search health status and the actual number of returned items, then show the result table:
| # | Author | Likes | Title | Link |
|---|---|---|---|---|
| 1 | author | likes/unavailable | desc | url |
- If an interaction field is missing, write
nulland infield_availabilitymarkfalse; if the actual returned number is0, then keep 0 and marktrue, and do not conflate the two. - When an empty array is returned, write
EMPTY_OR_FIELD_UNAVAILABLE; this cannot be used to assert that there is no related content on Douyin. - The currently installed OpenCLI 1.8.6's
douyin searchonly provides search result samples, and cards usually only have the likes field;douyin hashtag hotcan provide site-wide hot topics, and is already used by laohan-xuanti's discovery route.douyin hashtag searchcurrently fails in actual testing for the interface,hashtag hot --keywordNor can they be reliably filtered by keyword. Therefore, search volume, total supply, growth rate, and official content gap all default toUNAVAILABLE; they are used only when OpenCLI actually returns these fields in the future, and are not inferred from the number of results or likes. - Factual conclusions must be verified against the original video or authoritative sources; search results can only serve as discovery evidence.
- When the user separately requests search analysis, the visible content types and recurring angles in the results may be summarized; it must not determine the final topic of the workflow, and must not fabricate facts not provided by the search results.
- When specifying
episode, the runtime-locked wrapper must be used: first write the machine source of truth00-抖音搜索证据.json, then generate.mdfrom it; Markdown must not add conclusions that the JSON does not contain.
Minimal Episode JSON contract:
{
"schema_version": 1,
"collected_at": "ISO-8601",
"executor": {
"name": "opencli",
"version": "实际版本",
"doctor_status": "PASS|FAILED",
"logged_in": true,
"availability_status": "AVAILABLE|UNAVAILABLE"
},
"queries": [{
"query": "关键词",
"command": "opencli douyin search ... -f json",
"attempted_at": "ISO-8601",
"status": "OK|EMPTY_OR_FIELD_UNAVAILABLE|FAILED",
"result_count": 1,
"results": [{"id":"稳定id","rank":1,"desc":"原字段","author":"原字段","url":"https://..."}]
}]
}
OK must result_count > 0 and equal the length of results;EMPTY_OR_FIELD_UNAVAILABLE must be 0 and an empty array; FAILED must be 0, an empty array, and have error. When all queries FAILED or precheck fails, write availability_status: UNAVAILABLE, and still complete episode evidence persistence; ① do not infer from this that the platform has no demand.
Boundaries
- Downloading videos, blogger work lists: use
/laohan-xiazai。 - Comments, publishing, account operations: use
/laohan-yunyingor the corresponding OpenCLI adapter. - DrissionPage,
browser_cookie3cookie injection, independent user-data-dir, additional Chrome/Chromium, and background automatic publishing or replies are prohibited.