用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/mofa-org/mofa-skills --skill mofa-xhs命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | mofa-xhs |
| description | Xiaohongshu (小红书) integration — search notes, browse profiles, like/comment/publish via xhs-cli |
| triggers | ["小红书","xhs","xiaohongshu","rednote","笔记"] |
| requires_bins | xhs |
| install_hint | uv tool install xhs-cli |
| always | false |
Xiaohongshu (小红书, RedNote) integration via xhs-cli.
安装 xhs-cli
# 使用 uv (推荐)
uv tool install xhs-cli
# 或使用 pipx
pipx install xhs-cli
# 或使用 pip
pip install xhs-cli
小红书账号
认证登录 (三选一)
方式 A: 自动提取 Chrome cookies (推荐)
# 确保 Chrome 已登录小红书
xhs login
方式 B: 手动提供 Cookie
# 从浏览器开发者工具复制 Cookie
xhs login --cookie "a1=xxx; web_session=xxx; ..."
方式 C: 使用已保存的 Cookie 文件
# Cookie 将自动保存在 ~/.xhs/cookies.json
xhs status
验证安装
xhs status
预期输出应显示 "Logged in as: [username]"
# 搜索笔记
xhs search "咖啡" --limit 10
# 查看笔记详情
xhs read "https://www.xiaohongshu.com/discovery/item/xxx"
# 查看用户信息
xhs user "用户名"
| 问题 | 解决方案 |
|---|---|
xhs: command not found | 确保 ~/.local/bin 在 PATH 中,或重新安装 |
Not logged in | 运行 xhs login,确保 Chrome 已登录小红书 |
Cookie expired | 重新运行 xhs login 刷新 Cookie |
Rate limited | 降低请求频率,添加延迟参数 |
| 搜索无结果 | 检查关键词,尝试用中文关键词 |
┌─────────────────────────────────────────────────────────────────────────────┐
│ XIAOHONGSHU (小红书) SKILL │
└─────────────────────────────────────────────────────────────────────────────┘
User Request
↓
┌─────────────────────────────────────────────────────────┐
│ Intent Parser │
│ ──────────── │
│ • 搜索笔记 → Search Module │
│ • 查看详情 → Read Module │
│ • 用户资料 → User Module │
│ • 点赞评论 → Interact Module │
│ • 发布笔记 → Post Module │
└─────────────────────────┬───────────────────────────────┘
↓
┌─────────────────────┐
│ Auth Check │
│ xhs status │
└──────────┬──────────┘
↓
┌──────────────────────┐
│ xhs-cli │
│ (command wrapper) │
└──────────┬───────────┘
↓
┌──────────────────────┐
│ Xiaohongshu │
│ Platform │
└──────────────────────┘
# Search notes
xhs search "关键词"
xhs search "咖啡" --json
# Search topics/hashtags
xhs topics "旅行"
# Read note details
xhs read <note_id>
xhs read <note_id> --comments
# Browse feed
xhs feed
# User info
xhs user <user_id>
# User's posts
xhs user-posts <user_id>
# Followers/Following
xhs followers <user_id>
xhs following <user_id>
# Like / Unlike
xhs like <note_id>
xhs like <note_id> --undo
# Favorite / Unfavorite
xhs favorite <note_id>
xhs favorite <note_id> --undo
# Comment
xhs comment <note_id> "评论内容"
# Delete own note
xhs delete <note_id>
# Publish note
xhs post "标题" --image photo1.jpg --image photo2.jpg --content "正文"
xhs favorites
xhs favorites --max 10
xhs status
xhs whoami
xhs logout
All commands support --json for machine-readable output:
xhs search "咖啡" --json | jq '.[0].id'
xhs whoami --json | jq '.userInfo.userId'
xhs read <note_id> --json | jq '.title'
# Get your user ID
xhs whoami --json | jq -r '.userInfo.userId'
# Search and extract note IDs
xhs search "topic" --json | jq -r '.[].id'
# Check login before action
xhs status && xhs like <note_id>
xsec_token auto-resolved from cachexhs login over manual cookie inputxhs login if auth failsBased on actual testing (2026-03-13, macOS, xhs-cli v0.1.4):
uv tool install xhs-cli
Note: First run will auto-download ~306MB Camoufox browser (anti-fingerprint Firefox). Takes 1-3 minutes depending on network.
| Command | Status | Notes |
|---|---|---|
xhs feed | ✅ Works | Returns 35 recommended items |
xhs search | ❌ Requires login | Returns empty [] |
xhs topics | ❌ Requires login | Returns empty |
xhs read | ⚠️ Partial | Returns metadata but content may be empty |
xhs status | ✅ Works | Shows "Not logged in" |
Login required for full functionality:
Camoufox download fails
Login cookie extraction fails
xhs login without Chrome to get QR codeSearch returns empty
Rate limiting
# Test without login
xhs feed
# Should see table output with ~35 recommended notes
# If this works, installation is successful