Install
openclaw skills install xhs-monitor小红书竞品监控 - 自动采集竞品笔记,推送飞书通知,写入数据看板
openclaw skills install xhs-monitor自动采集小红书竞品账号的笔记,解析有价值内容,推送到飞书。
# 安装 Skill
npx clawhub@latest install xhs-monitor
# 或使用 clawhub CLI
clawhub install xhs-monitor
# 克隆项目
git clone https://github.com/你的用户名/xhs-monitor.git
cd xhs-monitor
# 安装依赖
npm install puppeteer-core
# 复制配置模板
cp config.example.js config.js
cp notify.example.js notify.js
编辑 config.js:
// 竞品账号列表(必填)
// 从小红书用户主页URL获取:xiaohongshu.com/user/profile/用户ID
const ACCOUNTS = [
{ name: '账号名1', id: '用户ID1' },
{ name: '账号名2', id: '用户ID2' },
];
// 账号主页URL映射(用于跳转链接)
const ACCOUNT_URLS = {
'账号名1': 'https://www.xiaohongshu.com/user/profile/用户ID1',
'账号名2': 'https://www.xiaohongshu.com/user/profile/用户ID2',
};
首次需要手动启动浏览器并扫码登录:
# Mac
export CHROMIUM_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
"$CHROMIUM_PATH" \
--remote-debugging-port=9223 \
--user-data-dir="$HOME/xhs-monitor/data/browser" \
"https://www.xiaohongshu.com/"
# 或使用 run.sh(自动检测)
bash run.sh
扫码登录后,浏览器保持打开状态即可。
cd xhs-monitor/src
node main.js
| 参数 | 说明 | 示例 |
|---|---|---|
| ACCOUNTS | 监控的账号列表 | { name: '账号名', id: '用户ID' } |
| ACCOUNT_URLS | 账号主页URL映射 | 用于跳转链接 |
如需使用飞书通知,需要:
im:message.send_as_userxhs-monitor/
├── src/
│ ├── main.js # 主程序入口
│ ├── config.js # 账号配置 ⚠️ 需复制 config.example.js
│ ├── config.example.js # 配置模板
│ ├── notify.js # 飞书推送 ⚠️ 需复制 notify.example.js
│ ├── notify.example.js # 推送模板
│ ├── parser.js # 内容解析
│ ├── dedupe.js # 去重模块
│ └── scraper.js # 浏览器采集
├── data/
│ └── history.csv # 历史记录(自动生成)
└── README.md
node src/main.js
编辑 crontab:
crontab -e
# 添加以下行:
6 14 * * * /usr/bin/node /path/to/xhs-monitor/src/main.js
6 18 * * * /usr/bin/node /path/to/xhs-monitor/src/main.js
6 21 * * * /usr/bin/node /path/to/xhs-monitor/src/main.js
A: 是的,首次登录后保持浏览器打开,程序会复用会话。
A: 检查浏览器是否以调试模式运行(--remote-debugging-port=9222)。
A: 编辑 config.js 中的 ACCOUNTS 数组。