xiaohongshu-cli
БесплатноБез исполняемых скриптовНе проверенUse xiaohongshu-cli for ALL Xiaohongshu (Little Red Book, 小红书) operations — searching notes, reading content, browsing users, liking, collecting, commenting…
от jackwener★ 2 756 звёзд на GitHubОб этом скилле
xiaohongshu-cli — Xiaohongshu CLI Tool
Binary: xhs
Credentials: browser cookies (auto-extracted) or browser-assisted QR login (--qrcode)
Setup
# Install (requires Python 3.10+)
uv tool install xiaohongshu-cli
# Or: pipx install xiaohongshu-cli
# Upgrade to latest (recommended to avoid API errors)
uv tool upgrade xiaohongshu-cli
# Or: pipx upgrade xiaohongshu-cli
Authentication
IMPORTANT FOR AGENTS: Before executing ANY xhs command, check if credentials exist first. Do NOT assume cookies are configured.
Step 0: Check if already authenticated
xhs status --yaml >/dev/null && echo "AUTH_OK" || echo "AUTH_NEEDED"
If AUTH_OK, skip to Command Reference.
If AUTH_NEEDED, proceed to Step 1. Prefer --qrcode when browser cookie extraction is unavailable but launching a browser is acceptable.
Step 1: Guide user to authenticate
Ensure user is logged into xiaohongshu.com in any browser supported by browser_cookie3. Supported browsers: Chrome, Arc, Edge, Firefox, Safari, Brave, Chromium, Opera, Opera GX, Vivaldi, LibreWolf, Lynx, w3m. Then:
xhs login # auto-detect browser with valid cookies
xhs login --cookie-source arc # specify browser explicitly
xhs login --qrcode # browser-assisted QR login with terminal QR output
Verify with:
xhs status
xhs whoami
Step 2: Handle common auth issues
| Symptom | Agent action |
|---|---|
NoCookieError: No 'a1' cookie found |
Guide user to login to xiaohongshu.com in browser |
NeedVerifyError: Captcha required |
Ask user to open browser, complete captcha, then retry |
IpBlockedError: IP blocked |
Suggest switching network (hotspot/VPN) |
SessionExpiredError |
Run xhs login to refresh cookies |
Agent Defaults
All machine-readable output uses the envelope documented in SCHEMA.md.
Payloads live under .data.
- Non-TTY stdout → auto YAML
--json/--yaml→ explicit formatOUTPUT=jsonenv → global overrideOUTPUT=richenv → force human output
Command Reference
Reading
| Command | Description | Example |
|---|---|---|
xhs search <keyword> |
Search notes | xhs search "美食" --sort popular --type video |
xhs read <id_or_url_or_index> |
Read a note by ID, URL, or short index | xhs read 1 / xhs read "https://...?xsec_token=xxx" |
xhs comments <id_or_url_or_index> |
Get comments by ID, URL, or short index | xhs comments 1 / xhs comments "https://...?xsec_token=..." |
xhs comments <id_or_url> --all |
Get ALL comments (auto-paginate) | xhs comments "<url>" --all --json |
xhs sub-comments <note_id> <comment_id> |
Get replies to comment | xhs sub-comments abc 123 |
xhs user <user_id> |
View user profile | xhs user 5f2e123 |
xhs user-posts <user_id> |
List user's notes | xhs user-posts 5f2e123 --cursor "" |
xhs feed |
Browse recommendation feed | xhs feed --yaml |
xhs hot |
Browse trending notes | xhs hot -c food |
xhs topics <keyword> |
Search topics/hashtags | xhs topics "旅行" |
xhs search-user <keyword> |
Search users | xhs search-user "摄影" |
xhs my-notes |
List own published notes | xhs my-notes --page 0 |
xhs notifications |
View notifications | xhs notifications --type likes |
xhs unread |
Show unread counts | xhs unread --json |
Interactions (Write)
| Command | Description | Example |
|---|---|---|
xhs like <id_or_url_or_index> |
Like a note | xhs like 1 / xhs like abc123 |
xhs like <id_or_url_or_index> --undo |
Unlike a note | xhs like 1 --undo |
xhs favorite <id_or_url_or_index> |
Bookmark a note | xhs favorite 1 |
xhs unfavorite <id_or_url_or_index> |
Remove bookmark | xhs unfavorite 1 |
xhs comment <id_or_url_or_index> -c "text" |
Post a comment | xhs comment 1 -c "好看!" |
xhs reply <id_or_url_or_index> --comment-id ID -c "text" |
Reply to comment | xhs reply 1 --comment-id 456 -c "谢谢" |
xhs delete-comment <note_id> <comment_id> |
Delete own comment | xhs delete-comment abc 123 -y |
Social
| Command | Description | Example |
|---|---|---|
xhs follow <user_id> |
Follow a user | xhs follow 5f2e123 |
xhs unfollow <user_id> |
Unfollow a user | xhs unfollow 5f2e123 |
xhs favorites [user_id] |
List bookmarked notes (defaults to self) | xhs favorites --json |
Creator
| Command | Description | Example |
|---|---|---|
xhs post --title "..." --body "..." --images img.png |
Publish a note | xhs post --title "Test" --body "Hello" |
xhs delete <id_or_url> |
Delete own note | xhs delete abc123 -y |
Account
| Command | Description |
|---|---|
xhs login |
Extract cookies from browser (auto-detect) |
| `xhs login --qrc |
Установить xiaohongshu-cli в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл xiaohongshu-cli?
Use xiaohongshu-cli for ALL Xiaohongshu (Little Red Book, 小红书) operations — searching notes, reading content, browsing users, liking, collecting, commenting, following, and posting. Invoke whenever the user requests any Xiaohongshu interaction.
Как установить скилл xiaohongshu-cli?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл xiaohongshu-cli запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic