xiaohongshu-cliSAFE
A CLI for Xiaohongshu (小红书) — search, read, interact via reverse-engineered API
Overview
From the repository's own README, as read at the audited commit. Badges and raw HTML are left out.
[](https://github.com/jackwener/xiaohongshu-cli/actions/workflows/ci.yml) [](https://pypi.org/project/xiaohongshu-cli/) [](https://pypi.org/project/xiaohongshu-cli/)
A CLI for Xiaohongshu (小红书) — search, read, interact, and post via reverse-engineered API 📕
English | 中文
More Tools
- bilibili-cli — Bilibili CLI for videos, users, search, and feeds
- twitter-cli — Twitter/X CLI for timelines, bookmarks, and posting
- discord-cli — Discord CLI for local-first sync, search, and export
- tg-cli — Telegram CLI for local-first sync, search, and export
Features
- 🔐 Auth — auto-extract browser cookies, QR code login, status check, whoami
- 🔍 Search — notes by keyword, user search, topic search
- 📖 Reading — note detail, comments, sub-comments, user profiles
- 🔢 Short-index navigation — open recent list results with
xhs read 1orxhs comments 1 - 📰 Feed — recommendation feed, hot/trending by category
- 👥 Social — follow/unfollow, favorites
- 👍 Interactions — like, favorite, comment, reply, delete
- ✍️ Creator — post image notes, my-notes list, delete
- 🔔 Notifications — unread count, mentions, likes, new followers
- 🛡️ Anti-detection — consistent macOS Chrome fingerprint,
sec-ch-uaalignment, session-stable browser identity, Gaussian jitter, captcha cooldown, exponential backoff - 📊 Structured output — commands support
--yamland--json; non-TTY stdout defaults to YAML - 📦 Stable envelope — see SCHEMA.md for
ok/schema_version/data/error
AI Agent Tip: Prefer `--
7987d16e0db9OBSERVED · 2026-10-20Install
Commands as the repository documents them. They are shown, not run.
uv tool install xiaohongshu-cli
uv tool upgrade xiaohongshu-cli
git clone [email protected]:jackwener/xiaohongshu-cli.git
uv sync
npx skills add jackwener/xiaohongshu-cli
git clone [email protected]:jackwener/xiaohongshu-cli.git .agents/skills/xiaohongshu-cli
Host compatibility
What the documentation claims. We have not run a compatibility test.
| Host | Status | Notes |
|---|---|---|
| cursor | mentioned | |
| openclaw | mentioned |
What it tells the agent
The instruction file, verbatim from the audited commit — this is the text the model reads, and the surface the audit's instruction layer examines. Quoted here so you can judge it without cloning anything.
---
name: xiaohongshu-cli
description: 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.
author: jackwener
version: "0.6.4"
tags:
- xiaohongshu
- xhs
- redbook
- 小红书
- social-media
- cli
---
# 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](#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](https://github.com/borisbabic/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
| 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](./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
| 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
```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
```bTrust audit
SAFEgrade B · trust 89/100 Nothing in the source contradicts what it says it does. Grade A is reserved for packages that have also passed the behavioural sandbox.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | PASS |
| L1 | Static analysis of the code | PASS |
| L2 | Instruction surface (what it tells the agent) | PASS |
| L3 | Class-specific surface | PASS |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- none-observed
- Network
- declared (3 observation(s))
- Shell
- none-observed
- Dependencies
- pinned
- Secrets in source
- none-found
Findings (5)
x1 = hashlib.md5(content.encode("utf-8")).hexdigest()envelope = json.loads(base64.b64decode(envelope_b64))
env1 = json.loads(base64.b64decode(r1["x-s"][4:]))
env2 = json.loads(base64.b64decode(r2["x-s"][4:]))
Gates applied: no_behavioural_pass, no_license.
7987d16e0db9full audit observations/trust-audit/skill/jackwener__xiaohongshu-cli.json · Report an issue / request a re-scanAudit history
Every audit this skill has had.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-20 | 7987d16e0db9 | SAFE | B | 89 | first audit |
Questions
What does the xiaohongshu-cli — jackwener/xiaohongshu-cli skill do?
A CLI for Xiaohongshu (小红书) — search, read, interact via reverse-engineered API
Is xiaohongshu-cli — jackwener/xiaohongshu-cli safe to install?
The audit found nothing in the source that contradicts what it says it does, and graded it B (89/100). Grade A is held back for packages that have also passed a sandboxed behavioural run, which is why a clean skill reads B.
What can xiaohongshu-cli — jackwener/xiaohongshu-cli access on my machine?
The audit observed that it reaches the network. Each of those is consistent with what it says it does. Secrets in the source: none found.
Which assistants does xiaohongshu-cli — jackwener/xiaohongshu-cli work with?
Its documentation mentions cursor and openclaw. That is what the text claims, not a compatibility test we ran.
How current is this page?
The grade is for one exact copy of the source (7987d16e0db9), read on 2026-10-20. The repository is watched, and a new audit runs when it changes — this is the first audit.
Add this badge to your README
Shows this page's audit result and links back to it. It updates when the audit does.
[](https://modelsatlas.com/skills/jackwener/xiaohongshu-cli/)
Not your listing, or something out of date? Claim or update your listing.