xiaohongshu-cli▌
jackwener/xiaohongshu-cli · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Binary: xhs
- ›Credentials: browser cookies (auto-extracted) or browser-assisted QR login (--qrcode)
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 --qrcode |
Browser-assisted QR login — terminal QR output, browser completes login |
xhs status |
Check authentication status |
xhs logout |
Clear cached cookies |
xhs whoami |
Show current user profile |
Agent Workflow Examples
Search → Read → Like pipeline
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
xhs hot -c food --json | jq '.data.items[:5] | .[].note_card | {title, likes: .interact_info.liked_count}'
Get user info then follow
xhs user 5f2e123 --json | jq '.data.basic_info | {nickname, user_id}'
xhs follow 5f2e123
Check notifications
xhs unread --json | jq '.data'
xhs notifications --type mentions --json | jq '.data.message_list[:5]'
Analyze all comments on a note
# 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
# 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
# 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
# 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 missingverification_required— captcha/verification neededip_blocked— IP rate limitedsignature_error— request signing failedapi_error— upstream API errorunsupported_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
NeedVerifyErroroccurs, 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.
How to use xiaohongshu-cli on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add xiaohongshu-cli
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches xiaohongshu-cli from GitHub repository jackwener/xiaohongshu-cli and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate xiaohongshu-cli. Access the skill through slash commands (e.g., /xiaohongshu-cli) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
User Story & Requirements Generation
Create detailed user stories, acceptance criteria, and feature specs
Example
Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios
Reduce spec writing time by 50%, ensure comprehensive coverage
Competitive Analysis
Research competitors, compare features, identify gaps
Example
Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities
Complete competitive research in 2 hours instead of 2 days
Roadmap Prioritization
Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs
Example
Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale
Make data-driven prioritization decisions faster
Stakeholder Communication
Draft PRDs, status updates, and stakeholder presentations
Example
Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement
Save 3-5 hours/week on communication overhead
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client
- ›Access to product documentation and roadmap tools (Jira, Notion, etc.)
- ›Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
- ›Stakeholder contact information and communication channels
Time Estimate
30-60 minutes to see productivity improvements
Installation Steps
- 1.Install product management skill
- 2.Start with user story generation for known feature
- 3.Progress to competitive analysis: research 2-3 competitors
- 4.Use for roadmap prioritization: apply RICE/ICE scoring
- 5.Draft stakeholder communications and refine based on feedback
- 6.Build template library for recurring PM tasks
- 7.Share effective prompts with product team
Common Pitfalls
- ⚠Not validating competitive research—verify facts before sharing
- ⚠Accepting user stories without involving engineering team
- ⚠Over-relying on frameworks without qualitative judgment
- ⚠Not customizing outputs to company culture and communication style
- ⚠Skipping stakeholder validation of generated requirements
Best Practices▌
✓ Do
- +Validate research and competitive analysis with real data
- +Collaborate with engineering when generating technical requirements
- +Customize frameworks and templates to your company context
- +Use skill for first drafts, refine with stakeholder input
- +Document successful prompt patterns for PM tasks
- +Combine AI efficiency with human judgment and intuition
✗ Don't
- −Don't publish competitive analysis without fact-checking
- −Don't finalize user stories without engineering review
- −Don't make prioritization decisions solely on AI scoring
- −Don't skip customer validation of generated requirements
- −Don't ignore company-specific context and culture
💡 Pro Tips
- ★Provide context: company goals, constraints, customer feedback
- ★Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
- ★Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
- ★Use skill for 70% generation + 30% customization to company needs
When to Use This▌
✓ Use When
Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.
✗ Avoid When
Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.
Learning Path▌
- 1Basic: user stories, feature specs, status updates
- 2Intermediate: competitive analysis, prioritization frameworks, PRDs
- 3Advanced: product strategy, go-to-market planning, OKR setting
- 4Expert: product vision, market positioning, business model innovation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.5★★★★★26 reviews- ★★★★★Pratham Ware· Dec 20, 2024
Registry listing for xiaohongshu-cli matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Kiara Martinez· Dec 4, 2024
Solid pick for teams standardizing on skills: xiaohongshu-cli is focused, and the summary matches what you get after install.
- ★★★★★Lucas Malhotra· Nov 23, 2024
xiaohongshu-cli has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Isabella Sethi· Nov 3, 2024
Keeps context tight: xiaohongshu-cli is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Ishan Torres· Oct 22, 2024
xiaohongshu-cli has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Kofi Torres· Oct 14, 2024
Keeps context tight: xiaohongshu-cli is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Yash Thakker· Sep 13, 2024
xiaohongshu-cli reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Aanya Thomas· Sep 1, 2024
Useful defaults in xiaohongshu-cli — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Emma Diallo· Aug 20, 2024
xiaohongshu-cli is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Dhruvi Jain· Aug 4, 2024
I recommend xiaohongshu-cli for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
showing 1-10 of 26