Xiaohongshu Ops
Overview
Use this skill for end-to-end XiaoHongShu operations:
- browse home recommendations or keyword search
- batch/random comment engagement
- automatic follow-up replies to existing comments in a feed
- automatic private-message replies (DM)
- publish image notes or video notes
Prerequisites
python3mcporterwithxiaohongshu-mcpserver configured- XiaoHongShu account login is valid
- Optional for
reply-dm --mode browser: VibeSurf endpoint (http://127.0.0.1:9335) - Optional for campaign image auto-generation: Pillow
Quick dependency check:
scripts/check_dependencies.sh
Main Script
scripts/xhs_ops.py
scripts/openclaw_campaign.py (cron-oriented workflow)
Quick Start
- Check login:
scripts/xhs_ops.py status
- Browse feed:
scripts/xhs_ops.py feed --count 10 --fallback-search-keyword "AI"
- Dry-run random engagement:
scripts/xhs_ops.py comment-random --dry-run --max-comments 2 --exclude-nickname "你的昵称" --fallback-search-keyword "AI"
- Publish one image note (dry-run first):
scripts/xhs_ops.py publish-image --dry-run --title "标题" --content "正文" --image "/abs/path/a.jpg" --tag "日常"
- Run OpenClaw campaign (dry-run):
scripts/openclaw_campaign.py --dry-run --exclude-nickname "你的昵称"
Capabilities
1) 刷帖 / 浏览
- Home recommendations:
scripts/xhs_ops.py feed --count 20
- Keyword search:
scripts/xhs_ops.py search "关键词" --count 20
2) 评论互动
- Random/batch comments from feed:
scripts/xhs_ops.py comment-random --max-comments 3 --comment-file ~/xhs_comments.txt --exclude-nickname "你的昵称"
- Fixed comment on specific feed:
scripts/xhs_ops.py comment-feed --feed-id "xxx" --xsec-token "yyy" --comment "感谢分享"
- 跟评自动回复(指定帖子评论区):
scripts/xhs_ops.py reply-comments --feed-id "xxx" --xsec-token "yyy" --reply-file ~/xhs_replies.txt --max-replies 3 --dry-run- 去掉
--dry-run即可真实回复
- 私信自动回复:
- 浏览器自动回复(推荐,适配当前无私信 API 的场景):
scripts/xhs_ops.py reply-dm --mode browser --reply-file ~/xhs_dm_replies.txt --max-replies 2 --dry-run- 去掉
--dry-run即可真实回复
- MCP 直连回复(需后端提供 DM 发送工具):
scripts/xhs_ops.py reply-dm --mode mcp --conversation-id "thread_xxx" --reply "收到,我稍后回复你"
- 浏览器自动回复(推荐,适配当前无私信 API 的场景):
3) 发帖
- Publish image note:
scripts/xhs_ops.py publish-image --title "标题" --content "正文" --image "/abs/path/a.jpg" --image "/abs/path/b.jpg" --tag "AI"
- Publish video note:
scripts/xhs_ops.py publish-video --title "标题" --content "正文" --video "/abs/path/demo.mp4" --tag "vlog"
- Scheduled publish:
- Add
--schedule-at "2026-03-01T10:30:00+08:00"
- Add
Safety Defaults
- Prefer
--dry-runbefore real posting. comment-randomdefaults to one comment per run and 30-minute interval guard.reply-dmdefaults to browser mode + max 1 conversation per run.- Track actions in local history (
~/.agent-reach/xiaohongshu-mcp/xhs_ops_history.json). - Use exclusion filters to avoid self-commenting.
- Campaign script stores state in
~/.agent-reach/xiaohongshu-mcp/openclaw_campaign_state.jsonto avoid repeated celebration posting.
Troubleshooting
- Login invalid:
- Run login flow first, then retry
scripts/xhs_ops.py status.
- Run login flow first, then retry
list_feedsfails:- Add
--fallback-search-keyword "AI"for feed/comment commands.
- Add
reply-dm --mode browserfails:- Check
VIBESURF_ENDPOINT(defaulthttp://127.0.0.1:9335) and ensure VibeSurf is healthy.
- Check
reply-dm --mode mcpfails with missing tool:- Current
xiaohongshu-mcpmay not expose DM APIs; switch to--mode browser.
- Current
- Session/API intermittent errors:
- Retry once and reduce
--max-comments.
- Retry once and reduce
Script Options
Run:
scripts/xhs_ops.py --helpscripts/xhs_ops.py <subcommand> --helpscripts/openclaw_campaign.py --help