Install
openclaw skills install @lfp1979/douyin-auto-reply通过 CLI 抓取抖音创作者中心评论并批量回复。触发词:'抖音评论'、'douyin 评论'、'抓抖音评论'、'回复抖音评论'、'douyin 自动回复'、'douyin auto reply'、'批量回复评论'、'douyin creator center comment'、'douyin comment manager'、'对作品自动回复'、'批量自动回复'、'按序号回复作品'、'按作品编号回复'。两个动作:--comment-list(只抓评论)、--reply(按作者+内容批量回复)。选作品:--title 按标题(可省略,省略则选第一个),或 --index 按序号(0-based)。工作流:抓评论 → 规则判断 → LLM 生成文案 → 直接发送(无审批节点、无 dry-run 中间步)。
openclaw skills install @lfp1979/douyin-auto-reply通过 CLI 抓取抖音创作者中心评论并批量回复。
不适用:B 站 / 小红书 / 知乎(用 opencli skill);下载视频;编辑资料 / 上传视频。
⚠️ agent 跑 --comment-list / --reply 之前,先检查环境,缺失就装:
cd <SKILL_DIR>/scripts
# 1. 检查 playwright npm 包(缺失则装,约 30 秒)
node -e "require('playwright')" 2>/dev/null || npm install
# 2. 检查 chromium 浏览器(缺失则装,约 1-2 分钟)
npx playwright install chromium --dry-run 2>&1 | grep -q "is already installed" || npx playwright install chromium
# 3. 检查登录态(缺失 → 让用户在浏览器里手动登录抖音创作者中心)
test -d ./user-data && echo "已登录:cookie 复用" || echo "首次使用:CLI 启动后会弹出 Chromium 让用户手动登录"
检查通过后再跑工作流命令。如果第 1/2 步执行安装,告诉用户「正在装 playwright / chromium,约 X 秒」。
cd <SKILL_DIR>/scripts
node index.js --comment-list [--title "xxx" | --index N]
stdout 一行 JSON:{ video, stats, comments },评论 id 形如 c1、c2-r1(详见 matching-rules.md)。
cd <SKILL_DIR>/scripts
node index.js --reply [--title "xxx" | --index N] --replies-file ./replies.json
# 或:--replies '<json>' 内联 / --author --content --text 单条便捷写法
⚠️ --reply 直接发送,无审批节点、无 dry-run 中间步。文案一旦调 --reply 就发出去了。
返回 JSON 的 result.replies[],每条:
| 状态 | 含义 |
|---|---|
ok: true | 匹配 + 发送成功 |
reason: "not-found" | 0 条匹配,没发出去 |
reason: "ambiguous" | 多条匹配,没发出去 |
reason: "toolbar-failed" / "send-failed" | 发到一半出错,需人工核对 |
| flag | 说明 |
|---|---|
--title "<视频名>" | 按标题子串匹配(忽略大小写) |
--index <N> | 按 0-based 序号 |
| 都省略 | 选第一个作品 |
| ⚠️ | --title 与 --index 互斥 |
{ "author": "亮有一计", "content": "免费", "text": "感谢推荐" }
| 字段 | 说明 |
|---|---|
author | 评论抓取的实际作者显示名(子串匹配) |
content | 评论抓取的实际内容片段(子串匹配) |
text | 要发送的回复文本 |
⚠️ author / content 必须是抓评论时拿到的实际值(agent 改写会导致 not-found)。
LLM 生成的文案字段叫
reply_text,写到replies.json时改名为text。
⚠️ 用户说「对作品"xxx"自动回复」「批量自动回复」时走这个流程。
--comment-listreply_textreplies.json → 调 --reply| # | 规则 |
|---|---|
| 1 | 跳过作者本人评论(is_author: true) |
| 2 顶级 | 作者是否直接回过(reply_to: null 且挂在本顶级下、时间 >= 评论时间) |
| 2 二级 | 作者是否回过这个人(reply_to === 该二级 user.name 且时间 >= 该二级时间) |
⚠️ 不能用 top.replies[] 是否非空判断——replies[] 是该顶级下所有二级对话(包括二级之间互回),不等于"作者是否回过这条顶级"。必须用 reply_to + 时间对比。
完整规则、判断算法伪代码见 auto-reply-workflow.md。
--reply 的 3 种方式cd <SKILL_DIR>/scripts
node index.js --reply [--title "x" | --index N] --replies-file ./replies.json
node index.js --reply --replies '[{"author":"x","content":"y","text":"z"}]'
⚠️ PowerShell 务必用单引号包裹双引号 JSON。
const { run } = require('<SKILL_DIR>/scripts/index');
const result = await run(
{ action: 'reply', title: 'x', list: [{ author: 'x', content: 'y', text: 'z' }] },
page // 已登录的 douyin 评论管理页
);
page 必须是同一 douyin 评论管理页且已登录。
完整 CLI 参数 + 返回结构见 cli.md。
| 现象 | 处理 |
|---|---|
Error: exit(2) | CLI 参数错,检查 --title / --index 和回复来源 flag(见 cli.md) |
| 卡在登录 5 分钟 | 浏览器手动登录 + 确认 URL 是 creator.douyin.com/creator-micro/interactive/comment |
Cannot find module 'playwright' | cd <SKILL_DIR>/scripts && npm install |
reason: not-found | 重跑 --comment-list,复制实际的作者名 / 内容片段 |
reason: ambiguous | 加更精确的关键词 |
完整排查见 troubleshooting.md。