← 返回 Skills 市场
go522000

抖音直播弹幕AI智能回复助手

作者 go522000 · GitHub ↗ · v0.1.0 · MIT-0
cross-platform ⚠ suspicious
164
总下载
1
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install douyin-live-ai
功能描述
实时采集抖音直播弹幕,使用DeepSeek AI分析用户意图,结合主播人设智能生成个性化回复并支持自动重连与缓存节省API调用。
使用说明 (SKILL.md)

抖音直播弹幕AI智能回复助手\r

\r

功能概述\r

\r 本 Skill 是一个完整的抖音直播弹幕采集与AI回复系统:\r

  1. 实时弹幕采集 - 通过 WebSocket 连接抖音直播服务器,实时获取弹幕\r
  2. AI 智能分析 - 使用 DeepSeek API 深度分析每条弹幕的用户意图\r
  3. 个性化回复 - 根据主播人设生成专业、亲切的回复建议\r
  4. 智能缓存 - 缓存最近100条回复,避免重复调用API,节省费用\r
  5. 自动重连 - 断线后自动重连,保持稳定运行\r
  6. 多场景支持 - 支持电商、教育、游戏、娱乐等直播类型\r \r

适用场景\r

\r

  • 电商直播:回复价格、质量、发货等咨询\r
  • 教育直播:解答学习、育儿、成长问题\r
  • 游戏直播:回应游戏技巧、出装、对局问题\r
  • 知识分享:回应观众提问和互动\r
  • 带货直播:引导下单、处理异议\r \r

项目结构\r

\r

douyin-live-ai/\r
├── SKILL.md                    # 本文件(Skill说明文档)\r
├── start.bat                   # 一键启动脚本(Windows)\r
├── scripts/                    # 核心脚本\r
│   ├── config.py              # 配置文件(填写直播间ID和API Key)\r
│   ├── main.py                # 程序入口(基础版)\r
│   ├── main_with_reconnect.py # 程序入口(推荐,自动重连)\r
│   ├── douyinlive.py          # WebSocket连接与消息处理\r
│   ├── deepseek_ai.py         # DeepSeek AI集成\r
│   ├── reply_cache.py         # 回复缓存管理(LRU)\r
│   ├── sign.js                # 抖音签名生成脚本\r
│   ├── get_sign_wrapper.js    # Node.js包装器(解决编码问题)\r
│   ├── douyin/                # Protobuf定义\r
│   │   ├── douyin.proto\r
│   │   └── douyin_pb2.py\r
│   └── CoreUtils/             # 加密工具\r
│       ├── __init__.py\r
│       └── Encrypt.py\r
└── references/                # 参考资料\r
    └── prompts.md             # AI提示词参考\r
```\r
\r
## 环境依赖\r
\r
- Python 3.7+\r
- Node.js(用于执行签名生成脚本)\r
- DeepSeek API Key(在 https://platform.deepseek.com/ 注册获取)\r
\r
### 安装Python依赖\r
\r
```bash\r
pip install websocket-client requests execjs protobuf\r
```\r
\r
## 快速开始\r
\r
### 第一步:配置直播间信息\r
\r
编辑 `scripts/config.py`,填写以下必填项:\r
\r
```python\r
# 直播间ID(URL最后的数字)\r
# 例如 https://live.douyin.com/349873582969 → ROOM_ID = "349873582969"\r
ROOM_ID = "your_room_id_here"\r
\r
# 直播类型\r
LIVE_TYPE = "entertainment"  # 可选: ecommerce, education, entertainment\r
\r
# 主播名称\r
HOST_NAME = "你的主播名称"\r
\r
# 主播简介(填写越详细,AI回复越准确)\r
HOST_INTRO = """\r
你的主播简介...\r
"""\r
\r
# DeepSeek API Key\r
DEEPSEEK_API_KEY = "your_deepseek_api_key_here"\r
# 也可通过环境变量设置(推荐):\r
# set DEEPSEEK_API_KEY=your_key(Windows)\r
# export DEEPSEEK_API_KEY=your_key(Linux/Mac)\r
```\r
\r
### 第二步:启动程序\r
\r
**方式一:双击 `start.bat`(推荐,Windows)**\r
- 自动设置UTF-8编码\r
- 在独立窗口运行,支持自动滚动\r
- 使用带自动重连的版本\r
\r
**方式二:命令行启动**\r
```bash\r
cd scripts\r
# 基础版\r
python main.py\r
# 自动重连版(推荐)\r
python main_with_reconnect.py\r
```\r
\r
### 第三步:查看输出\r
\r
```\r
============================================================\r
[2026-03-21 10:30:15] [API] 用户A: W什么技能\r
------------------------------------------------------------\r
DeepSeek AI回复: @用户A 朋友,W是黄金圣盾啊!开盾减速还能加护甲,对线换血的神技!\r
============================================================\r
\r
============================================================\r
[2026-03-21 10:30:45] [缓存] 用户B: 这出装怎么出?\r
------------------------------------------------------------\r
DeepSeek AI回复: @用户B 亲,这英雄核心装备是...\r
============================================================\r
```\r
\r
**标识说明:**\r
- `[API]` - 调用 DeepSeek API 实时生成的回复\r
- `[缓存]` - 相同问题命中缓存,直接复用(节省API调用)\r
\r
## 配置说明\r
\r
### config.py 完整配置\r
\r
```python\r
# ==================== 直播间配置 ====================\r
ROOM_ID = "your_room_id_here"           # 直播间ID(必填)\r
LIVE_TYPE = "entertainment"             # 直播类型\r
\r
# ==================== 主播简介配置 ====================\r
HOST_NAME = "你的主播名称"               # 主播名称(必填)\r
HOST_INTRO = """主播详细介绍..."""       # 主播简介(必填,越详细越好)\r
HOST_PERSONA = "主播人设风格"            # 人设风格\r
REPLY_STYLE = "humorous"               # 回复风格\r
\r
# ==================== DeepSeek API 配置 ====================\r
DEEPSEEK_API_KEY = "your_api_key"       # API Key(必填)\r
DEEPSEEK_API_URL = "https://api.deepseek.com/v1/chat/completions"\r
DEEPSEEK_MODEL = "deepseek-chat"        # 模型名称\r
TEMPERATURE = 0.7                       # 温度参数(0-2)\r
MAX_TOKENS = 500                        # 最大token数\r
\r
# ==================== 过滤配置 ====================\r
IGNORED_USERS = ["管理员", "系统消息"]   # 忽略用户\r
IGNORED_KEYWORDS = ["666", "哈哈哈"]     # 忽略关键词\r
MIN_MESSAGE_LENGTH = 2                  # 最小消息长度\r
```\r
\r
### 直播类型说明\r
\r
| LIVE_TYPE | 适用场景 | 回复风格 |\r
|-----------|---------|---------|\r
| `entertainment` | 游戏、娱乐直播 | 轻松幽默、积极互动 |\r
| `ecommerce` | 电商带货 | 引导下单、强调优惠 |\r
| `education` | 知识分享、教学 | 专业解答、耐心指导 |\r
\r
### 回复风格说明\r
\r
| REPLY_STYLE | 风格描述 |\r
|-------------|---------|\r
| `humorous` | 幽默风趣,活跃气氛 |\r
| `friendly` | 亲切友好,温暖互动 |\r
| `professional` | 专业严谨,权威解答 |\r
\r
## 核心功能详解\r
\r
### 智能过滤\r
- 自动过滤欢迎消息、礼物消息、系统消息\r
- 忽略纯数字、纯表情、无意义内容\r
- 可配置忽略特定用户和关键词\r
\r
### LRU 缓存机制\r
- 保存最近100条回复\r
- 相同问题直接返回缓存,节省API调用费用\r
- 缓存持久化到本地 `ai_replies_cache.json`\r
\r
### 自动重连\r
- 连接断开后自动重连,最多100次\r
- 每次重连间隔5秒\r
- `Ctrl+C` 可手动停止\r
\r
## 示例回复\r
\r
| 直播类型 | 用户弹幕 | AI 回复 |\r
|---------|---------|---------|\r
| 游戏 | "W什么技能?" | "@用户 朋友,W是黄金圣盾啊!开盾减速还能加护甲,对线换血的神技!" |\r
| 电商 | "这个多少钱?" | "@用户 宝子,这款今天直播间专属福利价!具体看左下角小黄车~" |\r
| 教育 | "高敏感孩子怎么引导" | "@用户 亲,高敏感孩子天赋满满!建议:1.接纳特质 2.提前告知变化..." |\r
| 娱乐 | "晚上好" | "@用户 欢迎宝子!今天福利多多,喜欢什么告诉我~" |\r
\r
## 故障排查\r
\r
| 问题 | 解决方案 |\r
|------|---------|\r
| GBK编码错误 | 使用 `start.bat` 启动,会自动设置UTF-8编码 |\r
| 连接失败/断开 | 使用 `main_with_reconnect.py`,自动重连 |\r
| 没有弹幕输出 | 确认直播间ID正确且正在直播 |\r
| AI回复很慢 | 检查网络;降低 `TEMPERATURE`;善用缓存 |\r
| Node.js 报错 | 确保已安装 Node.js:https://nodejs.org |\r
\r
## 注意事项\r
\r
1. **Node.js 环境**:必须安装 Node.js,用于执行抖音签名生成\r
2. **API Key 安全**:建议通过环境变量 `DEEPSEEK_API_KEY` 设置,避免硬编码\r
3. **网络连接**:需要稳定的网络连接抖音服务器\r
4. **频率限制**:注意 DeepSeek API 的调用频率和费用\r
\r
## 免责声明\r
\r
本项目仅供学习与技术交流使用,请勿用于任何商业或非法用途。\r
安全使用建议
What to check before installing or running: 1) Review sign.js: it is large and obfuscated and will be eval()'d by the Node wrapper — only run it if you trust the source. 2) Provide DEEPSEEK_API_KEY via environment variable (recommended); note the registry metadata omitted this requirement — that mismatch is a transparency issue. 3) Expect local files (ai_replies.jsonl, danmu_cache.jsonl and a cache JSON) to contain usernames, raw messages and AI replies — remove or protect these if they contain sensitive data. 4) Because the code spawns Node and executes JS and opens network connections to Douyin and DeepSeek, run it in an isolated environment (e.g., VM or container) if you don't fully trust the repository. 5) If you need higher assurance, request the author to: (a) provide a readable, non-obfuscated sign implementation or an explanation for the obfuscation, (b) update registry metadata to list DEEPSEEK_API_KEY as a required env var, and (c) document exactly what data is persisted and where.
功能分析
Type: OpenClaw Skill Name: douyin-live-ai Version: 0.1.0 The skill bundle contains high-risk execution patterns, most notably a large, heavily obfuscated JavaScript file (scripts/sign.js) used for generating Douyin's X-Bogus signature. This script is executed via eval() in scripts/get_sign_wrapper.js, which is in turn called as a sub-process from Python in scripts/douyinlive.py. While these capabilities are plausibly required to bypass Douyin's anti-scraping measures for the stated purpose of barrage collection, the combination of obfuscated code, eval(), and shell execution represents a significant attack surface and a potential vector for hidden malicious behavior.
能力评估
Purpose & Capability
The repository files implement what the description says: WebSocket connection to Douyin, protobuf parsing, signature generation (sign.js + Node wrapper), DeepSeek API integration, and an LRU reply cache. The required Node and Python dependencies and the DeepSeek API key are consistent with the functionality.
Instruction Scope
SKILL.md instructs editing config.py or providing DEEPSEEK_API_KEY (via env var) and running the Python + Node components. The runtime will persist full chat/reply records to local files (ai_replies.jsonl, danmu_cache.jsonl, and a cache JSON) containing usernames and messages — a privacy consideration. SKILL.md (pre-scan) also had a detected 'base64-block' pattern which could indicate embedded/encoded content in documentation or examples (or be a false positive), and should be inspected.
Install Mechanism
There is no formal install spec (instruction-only), so risk is limited to running the code. The code spawns a Node subprocess to eval the included sign.js (get_sign_wrapper.js reads sign.js and evals it). The sign.js file is heavily obfuscated/minified (large ~485KB) — while common for signature logic, executing obfuscated code via eval increases risk and should be inspected before running.
Credentials
The only runtime secret the project needs is the DeepSeek API key (DEEPSEEK_API_KEY), which is reasonable for the described purpose. However, the skill registry metadata listed 'no required env vars' while SKILL.md and config.py clearly require/expect DEEPSEEK_API_KEY — this metadata/instruction mismatch reduces transparency and should be fixed. No unrelated credentials are requested.
Persistence & Privilege
The skill doesn't request elevated platform privileges and 'always' is false. It writes local cache and log files in the scripts directory (ai_replies.jsonl, *_cache.json), which is expected for caching but has privacy implications. It doesn't modify other skills or system-wide settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install douyin-live-ai
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /douyin-live-ai 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.0
- 初始版本发布:抖音直播弹幕AI智能回复助手。 - 实现对抖音直播弹幕的实时采集与AI个性化智能回复,支持多种直播场景(电商、教育、游戏、娱乐)。 - 集成 DeepSeek API 进行弹幕理解与回复生成,可按主播人设和风格生成专业回答。 - 支持弹幕去重与LRU缓存,节省API调用费用。 - 断线自动重连,提升稳定性。 - 提供详细配置指导和启动脚本,兼容Windows与多平台环境。
元数据
Slug douyin-live-ai
版本 0.1.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

抖音直播弹幕AI智能回复助手 是什么?

实时采集抖音直播弹幕,使用DeepSeek AI分析用户意图,结合主播人设智能生成个性化回复并支持自动重连与缓存节省API调用。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 164 次。

如何安装 抖音直播弹幕AI智能回复助手?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install douyin-live-ai」即可一键安装,无需额外配置。

抖音直播弹幕AI智能回复助手 是免费的吗?

是的,抖音直播弹幕AI智能回复助手 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

抖音直播弹幕AI智能回复助手 支持哪些平台?

抖音直播弹幕AI智能回复助手 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 抖音直播弹幕AI智能回复助手?

由 go522000(@go522000)开发并维护,当前版本 v0.1.0。

💬 留言讨论