xhs-cli knowledge
小红书命令行工具 — 搜索、阅读、点赞、收藏、评论,全在终端完成
xhs is a CLI for Xiaohongshu (小红书) using Camoufox anti-fingerprint browser. Search, read, like, favorite, comment, and publish — all from the terminal.
Features
- Search notes by keyword and browse user profiles
- Read posts with full content, metrics, and comments
- Like, unlike, favorite, unfavorite, and comment on posts
- Publish image posts with title and content
- Auto-extract Chrome cookies or QR code login
- JSON output for all data commands
- Anti-fingerprint browsing via Camoufox
Install
uv: uv tool install xhs-clipipx: pipx install xhs-cli Commands
| Command | Syntax | Description |
|---|---|---|
login | xhs login | Authenticate via Chrome cookies or QR code |
search | xhs search <keyword> | Search notes by keyword |
read | xhs read <note_id> --comments | Read a post with comments |
like | xhs like <note_id> | Like a post |
favorite | xhs favorite <note_id> | Bookmark a post |
comment | xhs comment <note_id> <text> | Comment on a post |
post | xhs post <title> --image <img> --content <text> | Publish an image post |
Links
Agent Usage Example
Use cases:
- Search and read Xiaohongshu posts from the terminal
- Interact with posts via like, favorite, and comment
- Export search results in JSON for analysis
Example workflow:
xhs search 'coffee' --json | jq '.[].title'