xiaohongshu-cli

The xhs command-line tool for Xiaohongshu with a ready skill: the agent searches notes, reads comments and posts as you.

  • 2,722 ★ on the repository
  • Last commit
CLI

Broad access

Why this level

  • The tool reads cookies from installed browsers and keeps the account session in `~/.xiaohongshu-cli/cookies.json`.
  • Commands publish, comment, follow and delete on behalf of the account through an unofficial API, and the platform may restrict such an account.
All reasons and checks

jackwener/xiaohongshu-cli

Install

In your terminal, with SkillFoxx CLI

npx skillfoxx add cli/xiaohongshu-cli

Detects the agents on your machine, shows the access level and pins the version.

Other ways to install

Access and checks

How we review

Broad accessThe tool can change data, run commands or handle secrets.

  • The tool reads cookies from installed browsers and keeps the account session in `~/.xiaohongshu-cli/cookies.json`.
  • Commands publish, comment, follow and delete on behalf of the account through an unofficial API, and the platform may restrict such an account.

This is third-party code. Review the repository files before installing.

What it does

xiaohongshu-cli is a Python utility with the `xhs` command for the Xiaohongshu (小红书) social network. It searches notes and users, opens a note with its comments and replies, shows the recommendation feed and hot notes by category. It works through an unofficial API, with request signatures matched to the web client. Commands split into reading, social actions and author work: like, favourite, comment, reply, follow, publish an image note and delete. After any listing a short index applies: `xhs read 1` opens the first result. Output is YAML or JSON in a single envelope, which makes it easy for an agent to parse. The repository ships a `SKILL.md` that explains the login order and the commands to the agent.

Who it is for. Marketers and content managers who research Xiaohongshu and run an account there, plus developers building an agent for that platform.

Good fit when

  • Popular platform notes for a keyword must be collected and the comments under them read.
  • The agent watches new likes, mentions and followers through the notifications command.
  • An image note is published from the console or on a schedule from your own account.
  • Search results are passed on as YAML or JSON to other scripts and agents.

Not a fit when

  • Official, stable data access is required: the tool depends on request signatures matched to the web client and breaks when the API changes.
  • The Xiaohongshu account is a working one and must not face platform restrictions for automated actions.
  • A licence on the code matters: the repository has no licence file.

Example request

Find ten popular notes for the query "旅行", open the comments on the first one and show the result as YAML.

Limitations

The tool calls the closed Xiaohongshu API with signatures matched to the web client, so any API change breaks commands; the author advises updating regularly. Login needs browser cookies or a browser-assisted QR code. Saved cookies live for seven days in `~/.xiaohongshu-cli/cookies.json`. The platform may show a captcha or block the IP on frequent requests; a pause of about a second between requests is built in. Python 3.10 or newer is required. The last commit in the repository was made in March 2026.

How to disable. Remove the tool with `uv tool uninstall xiaohongshu-cli` or `pipx uninstall xiaohongshu-cli` and delete the `~/.xiaohongshu-cli` folder holding the cookies. Remove the skill from the agent skills directory.

FAQ

How do I install xiaohongshu-cli?

Run `uv tool install xiaohongshu-cli` or `pipx install xiaohongshu-cli`. Update with `uv tool upgrade xiaohongshu-cli`, otherwise outdated API handling will produce errors.

How do I log in to a Xiaohongshu account?

Sign in on the site in a browser and run `xhs login`: the tool finds cookies in installed browsers. Without browser cookies use `xhs login --qrcode` and scan the QR code the terminal shows.

How do I connect the skill to Claude Code?

Run `npx skills add jackwener/xiaohongshu-cli`. The `-a claude-code` flag picks the agent and `-g` installs the skill for all projects. The manual route is to clone the repository into `.agents/skills/xiaohongshu-cli`.

What does `xhs read 1` do?

It opens the first note from the latest listing, whether a search, the feed or a user's notes. `xhs comments`, `xhs like` and `xhs favorite` accept the same index.

In what format does the tool return data?

The `--yaml` and `--json` flags enable structured output with `ok`, `schema_version` and `data` fields. When output does not go to a terminal, YAML is chosen by default.

Discussion

No questions or reviews yet.

CLI tools

An OpenClaw skill that runs a Xiaohongshu account through the built-in browser: feed analysis, ideas, note drafting, comment replies and a knowledge base

SkillBroad access2.5KRepository stars

A Xiaohongshu CLI that searches and analyzes notes, compares creators, replies to comments and posts from your account

CLIBroad access537Repository stars

15 skills for Codex that cover Xiaohongshu content from account research and topic choice to title, draft and pre-publish QA

SkillExtended access281Repository stars

Self-hosted MCP server for xiaohongshu: publish notes and videos, search, read feeds, comment, like and favorite from an agent

MCP serverBroad access17KRepository stars

A visual-director skill for Xiaohongshu carousels: style choice, page structure, image prompts and the post caption

SkillMinimal access1.5KRepository stars

One skill and a CLI for the Knowledge Planet service: post search and publishing, replies, tags and scenarios for group owners.

SkillBroad access323Repository stars

Comparison with similar tools

Cards that share the main search query, and how they differ.

ToolOfficialAuthenticationRepository starsMain difference
xiaohongshu-cli (this card)no2,722
redbookno537also a console tool for Xiaohongshu with blogger analysis; here the focus is structured output, short indices and QR login
xiaohongshu-mcpnonot required16,967a self-hosted MCP server for publishing and the feed; here plain terminal commands and a skill

README in short

Features are grouped by task; login methods, cookie lifetime, environment variables and handling of platform limits are covered separately. A separate section covers installing the skill and sits next to the `SCHEMA.md` output schema.

README badge

Original SKILL.md

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

Report a problem

Foxx AIxiaohongshu-cli
Foxx AI

I am Foxx AI and I have already vetted this tool. Ask about install, setup or anything else, and I will keep it simple.