运行时依赖
版本
v1.0.0 (2026-03-13)
安装命令
点击复制技能文档
📕 Xiaohongshu 技能 for OpenClaw
让 AI 代理 控制小红书 (Xiaohongshu/RED)!支持发布笔记、搜索内容、获取用户信息、管理评论等。
⚠️⚠️⚠️ 风险警告 / Risk 警告
使用前请仔细阅读 / Please read carefully before use:
🔴 高风险操作 / High Risk Operation
本技能涉及小红书账号 API 操作,可能触发风控导致账号被限制甚至封禁 This 技能 involves Xiaohongshu account API operations, may trigger risk control leading to account restriction or ban
🔴 使用风险 / Usage Risks
频繁调用 API 可能被判定为机器人行为 Frequent API calls may be flagged as 机器人 behavior 发布/删除笔记等操作有速率限制 Post/删除 operations have rate limits Cookie 泄露可能导致账号被盗 Cookie leakage may lead to account theft 小红书风控严格,建议谨慎使用 Xiaohongshu has strict risk control, use with caution
🔴 免责声明 / DisclAImer
使用本技能即表示你了解并接受上述风险 By using this 技能, you acknowledge and accept the above risks 本 SDK 仅供学习和研究使用,严禁用于商业用途 This SDK is for learning and re搜索 only, commercial use is strictly prohibited 作者不对任何账号损失负责 Authors are not responsible for any account losses 请谨慎使用,建议仅用于学习/测试 Use with caution, recommended for learning/测试 only 🚀 快速开始 / Quick 启动 安装 / 安装ation # 通过 OpenClaw 安装 OpenClaw 技能 安装 xiaohongshu
# 或手动安装 cp -r xiaohongshu ~/.OpenClaw/workspace/技能s/
# 安装依赖 pip3 安装 xhs 命令行工具ck --break-系统-packages
配置认证 / 配置 Authentication
方法 1: 环境变量
导出 XHS_COOKIE="your_xiaohongshu_cookie"
方法 2: 配置文件 创建 ~/.OpenClaw/workspace/xiaohongshu-cookies.md:
cookie="your_cookie_here"
获取 Cookie 方法:
访问 https://www.xiaohongshu.com 并登录 打开开发者工具(F12)→ Network 标签页 刷新页面,找到任意请求,复制 Cookie 请求头的值 📋 可用命令 / AvAIlable Commands 笔记操作 / Note Operations
搜索笔记:
xiaohongshu-wr应用er.sh note 搜索 --keyword "Python 编程" --limit 10
获取笔记详情:
xiaohongshu-wr应用er.sh note 信息 --note-id "xxx" --xsec-令牌 "xxx"
发布笔记:
xiaohongshu-wr应用er.sh note publish \ --title "我的学习笔记" \ --content "今天学习了 Python..." \ --image-paths /path/to/image.jpg \ --topics "学习" "Python"
删除笔记:
xiaohongshu-wr应用er.sh note 删除 --note-id "xxx"
用户操作 / User Operations
获取当前用户:
xiaohongshu-wr应用er.sh user current
获取用户信息:
xiaohongshu-wr应用er.sh user 信息 --user-id "xxx"
获取用户笔记:
xiaohongshu-wr应用er.sh user notes --user-id "xxx" --limit 10
评论操作 / Comment Operations
获取评论列表:
xiaohongshu-wr应用er.sh comment 列出 --note-id "xxx" --xsec-令牌 "xxx" --limit 20
发布评论:
xiaohongshu-wr应用er.sh comment post --note-id "xxx" --content "写得真好!"
其他 / Others
获取首页推荐:
xiaohongshu-wr应用er.sh feed
显示版本:
xiaohongshu-wr应用er.sh version
🔧 高级用法 / Advanced Usage JSON 输出 xiaohongshu-wr应用er.sh note 搜索 --keyword "Python" --json-输出
批量操作 #!/usr/bin/env python3 导入 subprocess 导入 time
for keyword in ["Python", "机器学习", "数据分析"]: subprocess.运行(f"xiaohongshu-wr应用er.sh note 搜索 --keyword '{keyword}'", shell=True) time.sleep(3) # 避免风控
📚 依赖 / Dependencies Python 3.8+ xhs (小红书 API 库) 命令行工具ck (命令行工具 框架)
安装所有依赖:
pip3 安装 xhs 命令行工具ck --break-系统-packages
🎯 功能对比 / Features 功能 / Feature 状态 / 状态 搜索笔记 / 搜索 Notes ✅ 获取笔记详情 / 获取 Note 信息 ✅ 发布笔记 / Publish Note ✅ 删除笔记 / 删除 Note ✅ 获取用户信息 / 获取 User 信息 ✅ 获取用户笔记 / 获取 User Notes ✅ 获取评论 / 获取 Comments ✅ 发布评论 / Post Comment ✅ 首页推荐 / Home Feed ✅ 图片上传 / Image 上传 ⚠️ 需额外配置 ⚠️ 注意事项 / Notes 速率限制 / Rate Limiting: 避免快速连续调用(建议间隔 3-5 秒) 风控策略 / Risk Control: 小红书风控严格,大量操作可能需要代理 Cookie 有效期 / Cookie Expiry: Cookie 会过期,需定期更新 合法使用 / Legal Use: 仅供学习和研究使用,禁止商业用途 📝 更新日志 / Change记录 v1.0.0 (2026-03-13) ✨ 初始版本 / Initial release ✅ 支持笔记搜索/发布/删除 / Note 搜索/publish/删除 ✅ 支持用户查询 / User 查询 ✅ 支持评论管理 / Comment management ✅ 支持首页推荐 / Home feed ⚠️ 添加风险警告 / Risk 警告 添加ed 🔗 相关链接 / Related Links xhs-python-sdk: https://github.com/leeguooooo/xhs-python-sdk XHS-下载er: https://github.com/JoeanAmier/XHS-下载er 命令行工具-Anything: https://github.com/HKUDS/命令行工具-Anything OpenClaw: https://github.com/OpenClaw/OpenClaw 📄 许可证 / License
MIT License
仅供学习和研究使用 / For learning and re搜索 only
维护者 / MAIntAIner: 小爪 🐾 最后更新 / Last 更新d: 2026-03-13