Xiaohongshu Cli logo

Xiaohongshu Cli

CommunityPopular
jackwener
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.

Overview

Publisherjackwener
Repositoryxiaohongshu-cli
Skill namexiaohongshu-cli
Stars
2.6K
Forks
271
Bundled files
44
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 44 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by jackwener on GitHub. Read the source before you install it.

Installation

Install the Xiaohongshu Cli AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jackwener/xiaohongshu-cli.git \
  .claude/skills/xiaohongshu-cli
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Xiaohongshu Cli in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Xiaohongshu Cli on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Xiaohongshu Cli is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

xiaohongshu-cli — Xiaohongshu CLI Tool

Binary: xhs Credentials: browser cookies (auto-extracted) or browser-assisted QR login (--qrcode)

Setup

bash
# 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

bash
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:

bash
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:

bash
xhs status
xhs whoami

Step 2: Handle common auth issues

SymptomAgent action
NoCookieError: No 'a1' cookie foundGuide user to login to xiaohongshu.com in browser
NeedVerifyError: Captcha requiredAsk user to open browser, complete captcha, then retry
IpBlockedError: IP blockedSuggest switching network (hotspot/VPN)
SessionExpiredErrorRun 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 format
  • OUTPUT=json env → global override
  • OUTPUT=rich env → force human output

Command Reference

Reading

CommandDescriptionExample
xhs search <keyword>Search notesxhs search "美食" --sort popular --type video
xhs read <id_or_url_or_index>Read a note by ID, URL, or short indexxhs read 1 / xhs read "https://...?xsec_token=xxx"
xhs comments <id_or_url_or_index>Get comments by ID, URL, or short indexxhs comments 1 / xhs comments "https://...?xsec_token=..."
xhs comments <id_or_url> --allGet ALL comments (auto-paginate)xhs comments "<url>" --all --json
xhs sub-comments <note_id> <comment_id>Get replies to commentxhs sub-comments abc 123
xhs user <user_id>View user profilexhs user 5f2e123
xhs user-posts <user_id>List user's notesxhs user-posts 5f2e123 --cursor ""
xhs feedBrowse recommendation feedxhs feed --yaml
xhs hotBrowse trending notesxhs hot -c food
xhs topics <keyword>Search topics/hashtagsxhs topics "旅行"
xhs search-user <keyword>Search usersxhs search-user "摄影"
xhs my-notesList own published notesxhs my-notes --page 0
xhs notificationsView notificationsxhs notifications --type likes
xhs unreadShow unread countsxhs unread --json

Interactions (Write)

CommandDescriptionExample
xhs like <id_or_url_or_index>Like a notexhs like 1 / xhs like abc123
xhs like <id_or_url_or_index> --undoUnlike a notexhs like 1 --undo
xhs favorite <id_or_url_or_index>Bookmark a notexhs favorite 1
xhs unfavorite <id_or_url_or_index>Remove bookmarkxhs unfavorite 1
xhs comment <id_or_url_or_index> -c "text"Post a commentxhs comment 1 -c "好看!"
xhs reply <id_or_url_or_index> --comment-id ID -c "text"Reply to commentxhs reply 1 --comment-id 456 -c "谢谢"
xhs delete-comment <note_id> <comment_id>Delete own commentxhs delete-comment abc 123 -y

Social

CommandDescriptionExample
xhs follow <user_id>Follow a userxhs follow 5f2e123
xhs unfollow <user_id>Unfollow a userxhs unfollow 5f2e123
xhs favorites [user_id]List bookmarked notes (defaults to self)xhs favorites --json

Creator

CommandDescriptionExample
xhs post --title "..." --body "..." --images img.pngPublish a notexhs post --title "Test" --body "Hello"
xhs delete <id_or_url>Delete own notexhs delete abc123 -y

Account

CommandDescription
xhs loginExtract cookies from browser (auto-detect)
xhs login --qrcodeBrowser-assisted QR login — terminal QR output, browser completes login
xhs statusCheck authentication status
xhs logoutClear cached cookies
xhs whoamiShow current user profile

Agent Workflow Examples

Search → Read → Like pipeline

bash
NOTE_ID=$(xhs search "美食推荐" --json | jq -r '.data.items[0].id')
xhs read "$NOTE_ID" --json | jq '.data'
xhs like "$NOTE_ID"

Browse trending food notes

bash
xhs hot -c food --json | jq '.data.items[:5] | .[].note_card | {title, likes: .interact_info.liked_count}'

Get user info then follow

bash
xhs user 5f2e123 --json | jq '.data.basic_info | {nickname, user_id}'
xhs follow 5f2e123

Check notifications

bash
xhs unread --json | jq '.data'
xhs notifications --type mentions --json | jq '.data.message_list[:5]'

Analyze all comments on a note

bash
# Fetch ALL comments and analyze themes
xhs comments "$NOTE_URL" --all --json | jq '.data.comments | length'
# Count questions
xhs comments "$NOTE_URL" --all --json | jq '[.data.comments[] | select(.content | test("[\uff1f?]"))] | length'

Daily reading workflow

bash
# Browse recommendation feed
xhs feed --yaml

# Interactive short-index workflow
xhs search "旅行"
xhs read 1
xhs comments 1
xhs like 1
xhs favorite 1
xhs comment 1 -c "收藏了"

# Browse trending by category
xhs hot -c food --yaml
xhs hot -c travel --yaml

QR code login

bash
# When browser cookie extraction is not available
xhs login --qrcode
# → Launches a browser-assisted login flow
# → Renders QR in terminal using Unicode half-blocks
# → Scan with Xiaohongshu app → confirm → export cookies

URL to insights pipeline

bash
# User pastes a URL → read + all comments
xhs read "https://www.xiaohongshu.com/explore/xxx?xsec_token=yyy" --json
xhs comments "https://www.xiaohongshu.com/explore/xxx?xsec_token=yyy" --all --json

Hot Categories

Available for xhs hot -c <category>: fashion, food, cosmetics, movie, career, love, home, gaming, travel, fitness

Error Codes

Structured error codes returned in the error.code field:

  • not_authenticated — cookies expired or missing
  • verification_required — captcha/verification needed
  • ip_blocked — IP rate limited
  • signature_error — request signing failed
  • api_error — upstream API error
  • unsupported_operation — operation not available

Limitations

  • No video download — cannot download note images/videos
  • No DMs — cannot access private messages
  • No live streaming — live features not supported
  • No following/followers list — XHS web API doesn't expose these endpoints
  • Single account — one set of cookies at a time
  • Rate limited — built-in Gaussian jitter delay (~1-1.5s) between requests; aggressive usage may trigger captchas or IP blocks

Anti-Detection Notes for Agents

  • Do NOT parallelize requests — the built-in rate-limit delay exists for account safety
  • Captcha recovery: if NeedVerifyError occurs, the client auto-cools-down with increasing delays (5s→10s→20s→30s). Ask the user to complete captcha in browser before retrying
  • Batch operations: when doing bulk work (e.g., reading many notes), add time.sleep() between CLI calls
  • Session stability: all requests in a session share a consistent browser fingerprint. Restarting the CLI creates a new fingerprint session

Safety Notes

  • Do not ask users to share raw cookie values in chat logs.
  • Prefer local browser cookie extraction over manual secret copy/paste.
  • If auth fails, ask the user to re-login via xhs login.
  • Agent should treat cookie values as secrets (do not echo to stdout unnecessarily).
  • Built-in rate-limit delay protects accounts; do not bypass it.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Xiaohongshu Cli AI skill do?

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.

Why use Xiaohongshu Cli on TypingMind?

Because you install it once and use it with any model. Xiaohongshu Cli is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Xiaohongshu Cli in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/jackwener/xiaohongshu-cli/tree/main. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Xiaohongshu Cli?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Xiaohongshu Cli?

As many as you like. As long as a model supports skills, you can use Xiaohongshu Cli with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Xiaohongshu Cli AI skill free?

It is published on GitHub by jackwener. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇