xiaohongshu-cli knowledge
Search, read, and interact with Xiaohongshu (小红书) from your terminal
xhs is a full-featured CLI for Xiaohongshu (小红书) via reverse-engineered API. Search notes, read posts, interact with content, and even publish — all from the terminal.
Features
- Search notes by keyword and discover trending topics
- Read posts with full content, metrics, and comments
- Like, favorite, comment, and follow/unfollow
- Publish image posts with title and captions
- Browse recommendation feeds and hot posts by category
- Track notifications and unread activity
- Structured output (JSON/YAML) for AI agent integration
- Auto-extract cookies from browsers or QR code login
Install
uv: uv tool install xiaohongshu-clipipx: pipx install xiaohongshu-cli Commands
| Command | Syntax | Description |
|---|---|---|
login | xhs login | Authenticate via browser cookies or QR code |
search | xhs search <keyword> | Search notes by keyword |
read | xhs read <index> | Read a post from the last listing |
feed | xhs feed | Browse recommendation feed |
hot | xhs hot -c <category> | Browse hot posts by category |
like | xhs like <index> | Like a post from the last listing |
post | xhs post --title <title> --body <text> --images <img> | Publish an image post |
Links
Agent Usage Example
Use cases:
- Search and summarize Xiaohongshu discussions on a topic
- Monitor trending content and hot categories
- Extract post data for content analysis
Example workflow:
xhs search '咖啡推荐' --json | jq '.[].title'