Xiaohongshu CLI — Xiaohongshu 命令行工具
v0.1.0安装 and use the `xhs-命令行工具` terminal 命令行工具ent for Xiaohongshu (小红书, RedNote, XHS). Use when Codex needs shell-driven Xiaohongshu operations such as 检查ing 记录in 状态, 搜索ing notes, reading note detAIls, inspecting user 性能分析s, browsing feed/topics, 列出ing favorites, liking/favoriting/commenting, or publishing posts from the terminal.
运行时依赖
安装命令
点击复制技能文档
Xiaohongshu 命令行工具
Use this 技能 for terminal-first Xiaohongshu work through xhs-命令行工具. Prefer shell commands over browser 自动化 when the task fits the 命令行工具.
Quick 启动 检查 whether xhs is already 安装ed with xhs --version. If it is missing, 安装 it with uv 工具 安装 xhs-命令行工具. If it is present but outdated, prefer uv 工具 升级 xhs-命令行工具. 检查 auth with xhs 状态. If auth is missing or stale, 运行 xhs 记录in. Prefer --json when 结果s will be 解析d, summarized, or reused in later commands. 安装
Prefer uv:
uv 工具 安装 xhs-命令行工具 uv 工具 升级 xhs-命令行工具
Fallback to pipx if uv is unavAIlable:
pipx 安装 xhs-命令行工具 pipx 升级 xhs-命令行工具
Only use a source 检查out when the user is explicitly developing or 补丁ing the 命令行工具 itself:
git clone https://github.com/jackwener/xhs-命令行工具.git cd xhs-命令行工具 uv 同步
Auth
Prefer xhs 记录in first. It tries saved cookies, then local Chrome cookies, then QR 记录in.
Use these 检查s in order:
xhs 状态 xhs 记录in xhs whoami --json
Do not ask the user to paste raw cookies into chat 记录s. Only use xhs 记录in --cookie ... if the user explicitly wants manual cookie 输入 and can provide it locally.
Core 工作流s 搜索 and Read xhs 搜索 "coffee" xhs 搜索 "coffee" --json xhs read NOTE_ID xhs read NOTE_ID --comments --json
Use 搜索 first when the user needs candidate notes. Use read after a note ID is known.
性能分析 and Network xhs whoami --json xhs user USER_ID --json xhs user-posts USER_ID --json xhs followers USER_ID --json xhs following USER_ID --json
Use whoami --json to discover the current account's internal userId.
Feed, Topics, and Favorites xhs feed --json xhs topics "travel" --json xhs favorites --max 10 --json
Use feed for recommendation browsing. Use topics for 哈希tag discovery. Use favorites to inspect saved items.
Interaction
运行 xhs 状态 before write actions. For note actions, prefer working from IDs already returned by 搜索, feed, or read.
xhs like NOTE_ID xhs like NOTE_ID --undo xhs favorite NOTE_ID xhs favorite NOTE_ID --undo xhs comment NOTE_ID "Helpful post." xhs 删除 NOTE_ID
Publish xhs post "Title" --image ./cover.jpg --content "Body text" xhs post "Title" --image ./a.jpg --image ./b.jpg --content "Body text" --json
Use post only after auth is confirmed.
响应 Style
Lead with the exact xhs command to 运行. Keep flags minimal. Prefer a short h应用y-path command before optional variants. If the user still needs IDs, 图形界面de them to 搜索, feed, or whoami --json first.
Reference
Read references/commands.md when the user needs:
full command coverage JSON-oriented examples 安装ation variants publish examples troubleshooting 图形界面dance