[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-74196":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":9,"pushedAt":9,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":15,"starSnapshotCount":15,"syncStatus":28,"lastSyncTime":29,"discoverSource":30},74196,"xiaohongshu-cli","jackwener\u002Fxiaohongshu-cli","jackwener","A CLI for Xiaohongshu (小红书) — search, read, interact via reverse-engineered API",null,"Python",2186,224,5,25,0,47,111,348,141,29.06,false,"main",true,[],"2026-06-12 02:03:23","# xiaohongshu-cli\n\n[![CI](https:\u002F\u002Fgithub.com\u002Fjackwener\u002Fxiaohongshu-cli\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fjackwener\u002Fxiaohongshu-cli\u002Factions\u002Fworkflows\u002Fci.yml)\n[![PyPI version](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fxiaohongshu-cli.svg)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fxiaohongshu-cli\u002F)\n[![Python](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fpython-%3E%3D3.10-blue.svg)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fxiaohongshu-cli\u002F)\n\nA CLI for Xiaohongshu (小红书) — search, read, interact, and post via reverse-engineered API 📕\n\n[English](#features) | [中文](#功能特性)\n\n## More Tools\n\n- [bilibili-cli](https:\u002F\u002Fgithub.com\u002Fjackwener\u002Fbilibili-cli) — Bilibili CLI for videos, users, search, and feeds\n- [twitter-cli](https:\u002F\u002Fgithub.com\u002Fjackwener\u002Ftwitter-cli) — Twitter\u002FX CLI for timelines, bookmarks, and posting\n- [discord-cli](https:\u002F\u002Fgithub.com\u002Fjackwener\u002Fdiscord-cli) — Discord CLI for local-first sync, search, and export\n- [tg-cli](https:\u002F\u002Fgithub.com\u002Fjackwener\u002Ftg-cli) — Telegram CLI for local-first sync, search, and export\n\n## Features\n\n- 🔐 **Auth** — auto-extract browser cookies, QR code login, status check, whoami\n- 🔍 **Search** — notes by keyword, user search, topic search\n- 📖 **Reading** — note detail, comments, sub-comments, user profiles\n- 🔢 **Short-index navigation** — open recent list results with `xhs read 1` or `xhs comments 1`\n- 📰 **Feed** — recommendation feed, hot\u002Ftrending by category\n- 👥 **Social** — follow\u002Funfollow, favorites\n- 👍 **Interactions** — like, favorite, comment, reply, delete\n- ✍️ **Creator** — post image notes, my-notes list, delete\n- 🔔 **Notifications** — unread count, mentions, likes, new followers\n- 🛡️ **Anti-detection** — consistent macOS Chrome fingerprint, `sec-ch-ua` alignment, session-stable browser identity, Gaussian jitter, captcha cooldown, exponential backoff\n- 📊 **Structured output** — commands support `--yaml` and `--json`; non-TTY stdout defaults to YAML\n- 📦 **Stable envelope** — see [SCHEMA.md](.\u002FSCHEMA.md) for `ok\u002Fschema_version\u002Fdata\u002Ferror`\n\n> **AI Agent Tip:** Prefer `--yaml` for structured output unless strict JSON is required. Non-TTY stdout defaults to YAML automatically.\n\n## Installation\n\n```bash\n# Recommended: uv tool (fast, isolated)\nuv tool install xiaohongshu-cli\n\n# Or: pipx\npipx install xiaohongshu-cli\n```\n\nUpgrade to the latest version:\n\n```bash\nuv tool upgrade xiaohongshu-cli\n# Or: pipx upgrade xiaohongshu-cli\n```\n\n> **Tip:** Upgrade regularly to avoid unexpected errors from outdated API handling.\n\nFrom source:\n\n```bash\ngit clone git@github.com:jackwener\u002Fxiaohongshu-cli.git\ncd xiaohongshu-cli\nuv sync\n```\n\n## Usage\n\n```bash\n# ─── Auth ─────────────────────────────────────────\nxhs login                             # Extract cookies from browser\nxhs login --qrcode                    # Browser-assisted QR login, scan in terminal\nxhs status                            # Check login status\nxhs whoami                            # Detailed profile (fans, likes, etc)\nxhs whoami --json                     # Structured JSON envelope\nxhs logout                            # Clear saved cookies\n\n# ─── Search ───────────────────────────────────────\nxhs search \"美食\"                      # Search notes\nxhs search \"旅行\" --sort popular       # Sort: general, popular, latest\nxhs search \"穿搭\" --type video         # Filter: all, video, image\nxhs search \"AI\" --page 2              # Pagination\nxhs search-user \"用户名\"               # Search users\nxhs topics \"美食\"                      # Search hashtags\u002Ftopics\n\n# ─── Reading ──────────────────────────────────────\nxhs read 1                             # Read the 1st result from the last list command\nxhs read \u003Cnote_id>                     # Read a note (API only)\nxhs read \"https:\u002F\u002Fwww.xiaohongshu.com\u002Fexplore\u002Fxxx?xsec_token=yyy\"  # Read by URL (uses URL token)\nxhs comments 1                         # Read comments for the 1st result from the last list command\nxhs comments \"\u003Curl>\"                   # View comments — paste URL to cache\u002Freuse xsec_token\nxhs comments \"\u003Curl>\" --all             # Fetch ALL comments (auto-paginate all pages)\nxhs comments \"\u003Curl>\" --all --json      # All comments as JSON\nxhs comments \u003Cnote_id> --xsec-token T  # Use note_id + explicit xsec_token\nxhs comments \u003Cnote_id>                 # Reuse cached token if available\nxhs sub-comments \u003Cnote_id> \u003Ccmt_id>   # View replies to a comment\nxhs user \u003Cuser_id>                     # User profile\nxhs user-posts \u003Cuser_id>              # User's published notes\nxhs user-posts \u003Cuser_id> --cursor X   # Paginate with cursor\n\n# ─── Feed & Discovery ────────────────────────────\nxhs feed                              # Recommendation feed\nxhs hot                               # Hot notes (default: food)\nxhs hot -c fashion                    # Categories: fashion, food, cosmetics,\n                                      #   movie, career, love, home, gaming,\n                                      #   travel, fitness\n\n# Short index works after list commands such as search\u002Ffeed\u002Fhot\u002Fuser-posts\u002Ffavorites\u002Fmy-notes\nxhs search \"黑丝\"\nxhs read 1\nxhs comments 1\nxhs like 1\nxhs favorite 1\n\n# ─── Social ───────────────────────────────────────\nxhs favorites                          # My bookmarked notes (current user)\nxhs favorites \u003Cuser_id>                # Other user's bookmarked notes\nxhs likes                             # My liked notes (current user)\nxhs likes \u003Cuser_id>                   # Other user's liked notes\nxhs follow \u003Cuser_id>                   # Follow a user\nxhs unfollow \u003Cuser_id>                 # Unfollow a user\n\n# ─── Interactions ─────────────────────────────────\nxhs like 1                             # Like the 1st result from the latest note listing\nxhs like \u003Cnote_id>                     # Like a note\nxhs like \u003Cnote_id> --undo             # Unlike\nxhs favorite 1                         # Favorite the 1st result from the latest note listing\nxhs favorite \u003Cnote_id>                 # Favorite (bookmark)\nxhs unfavorite 1                       # Unfavorite the 1st result from the latest note listing\nxhs unfavorite \u003Cnote_id>               # Unfavorite\nxhs comment 1 -c \"好赞！\"              # Comment on the 1st result from the latest note listing\nxhs comment \u003Cnote_id> -c \"好赞！\"     # Post comment\nxhs reply 1 --comment-id X -c \"回复\"   # Reply on the 1st result from the latest note listing\nxhs reply \u003Cnote_id> --comment-id X -c \"回复\"  # Reply to comment\nxhs delete-comment \u003Cnote_id> \u003Ccmt_id> # Delete own comment\n\n# ─── Creator ─────────────────────────────────────\nxhs my-notes                           # List own notes (v2 creator endpoint)\nxhs my-notes --page 1                 # Next page\nxhs post --title \"标题\" --body \"正文\" --images img.jpg  # Post note\nxhs delete \u003Cnote_id>                   # Delete note\nxhs delete \u003Cnote_id> -y               # Skip confirmation\n\n# ─── Notifications ────────────────────────────────\nxhs unread                             # Unread counts (likes, mentions, follows)\nxhs notifications                      # 评论和@ notifications\nxhs notifications --type likes        # 赞和收藏 notifications\nxhs notifications --type connections   # 新增关注 notifications\n\n```\n\n## Authentication\n\nxiaohongshu-cli supports multiple authentication methods:\n\n1. **Saved cookies** — loads from `~\u002F.xiaohongshu-cli\u002Fcookies.json`\n2. **Browser cookies** — auto-detects installed browsers and extracts cookies (supports Chrome, Arc, Edge, Firefox, Safari, Brave, Chromium, Opera, Vivaldi, and more)\n3. **QR code login** — browser-assisted login with terminal QR output (`xhs login --qrcode`)\n\n`xhs login` automatically tries all installed browsers and uses the first one with valid cookies.\nUse `--cookie-source \u003Cbrowser>` to specify a browser explicitly, or `--qrcode` for browser-assisted QR login.\nOther authenticated commands automatically retry once with fresh browser cookies when the saved session has expired.\n\n### Cookie TTL\n\nSaved cookies are valid for **7 days** by default. After that, the client automatically attempts to refresh from the browser. If browser extraction fails, the existing cookies are used with a warning.\n\n### Short-Index Navigation\n\nAfter any listing command such as `search`, `feed`, `hot`, `user-posts`, `favorites`, or `my-notes`, the CLI stores the latest ordered note list in `~\u002F.xiaohongshu-cli\u002Findex_cache.json`.\n\n- `xhs read \u003CN>` opens the Nth note from the latest listing\n- `xhs comments \u003CN>` opens comments for the Nth note from the latest listing\n- `xhs like \u003CN>`, `xhs favorite \u003CN>`, `xhs unfavorite \u003CN>`, `xhs comment \u003CN>`, and `xhs reply \u003CN>` reuse the same short index\n- Empty listings clear the index cache, so old results are not reused by accident\n\n## Environment Variables\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `OUTPUT` | `auto` | Output format: `json`, `yaml`, `rich`, or `auto` (→ YAML when non-TTY) |\n## Rate Limiting & Anti-Detection\n\nxiaohongshu-cli includes comprehensive anti-risk-control measures designed to minimize detection:\n\n### Request Timing\n- **Gaussian jitter**: Delays between requests use a truncated Gaussian distribution (not fixed intervals) to mimic natural browsing patterns\n- **Random long pauses**: ~5% of requests include an additional 2-5 second delay simulating reading behavior\n- **Auto-retry**: Exponential backoff on HTTP 429\u002F5xx and network errors (up to 3 retries)\n\n### Browser Fingerprint Consistency\n- **UA\u002FPlatform alignment**: User-Agent, `sec-ch-ua`, `sec-ch-ua-platform`, and fingerprint fields are all consistent (macOS Chrome 145)\n- **Session-stable identity**: GPU, screen resolution, CPU cores, and other hardware fingerprint values are generated once per session and reused across all requests (real browsers don't change hardware mid-session)\n- **macOS-native values**: GPU vendors (Apple M1\u002FM2\u002FM3, Intel Iris), Retina screen resolutions, `MacIntel` platform — all matching a real macOS browser\n\n### Captcha Cooldown\n- **Progressive backoff**: On captcha trigger (HTTP 461\u002F471), automatically sleeps 5→10→20→30 seconds with increasing delays\n- **Adaptive rate limiting**: Request delay is permanently doubled after a captcha event to reduce future risk\n\n### Signed Requests\n- All API calls use `x-s` \u002F `x-s-common` \u002F `x-t` signatures (reverse-engineered from web client)\n- `x-b3-traceid` and `x-xray-traceid` for distributed tracing consistency\n\n## Structured Output\n\nAll `--json` \u002F `--yaml` output uses the shared envelope from [SCHEMA.md](.\u002FSCHEMA.md):\n```yaml\nok: true\nschema_version: \"1\"\ndata: { ... }\n```\n\nWhen stdout is not a TTY (e.g., piped or invoked by an AI agent), output defaults to YAML.\nUse `OUTPUT=yaml|json|rich|auto` to override.\n\n## Use as AI Agent Skill\n\nxiaohongshu-cli ships with a [`SKILL.md`](.\u002FSKILL.md) that teaches AI agents how to use it.\n\n### [Skills CLI](https:\u002F\u002Fgithub.com\u002Fvercel-labs\u002Fskills) (Recommended)\n\n```bash\nnpx skills add jackwener\u002Fxiaohongshu-cli\n```\n\n| Flag | Description |\n| --- | --- |\n| `-g` | Install globally (user-level, shared across projects) |\n| `-a claude-code` | Target a specific agent |\n| `-y` | Non-interactive mode |\n\n### Manual Install\n\n```bash\nmkdir -p .agents\u002Fskills\ngit clone git@github.com:jackwener\u002Fxiaohongshu-cli.git .agents\u002Fskills\u002Fxiaohongshu-cli\n```\n\n### ~~OpenClaw \u002F ClawHub~~ (Deprecated)\n\n> ⚠️ ClawHub install method is deprecated and no longer supported. Use [Skills CLI](#skills-cli-recommended) or Manual Install above.\n\n## Project Structure\n\n```text\nxhs_cli\u002F\n├── __init__.py\n├── cli.py              # Click entry point & command registration\n├── client.py           # XHS API client (signing, retry, rate-limit, anti-detection)\n├── cookies.py          # Cookie extraction, TTL management, auto-refresh, token cache\n├── signing.py          # Main API x-s \u002F x-s-common signature generation\n├── creator_signing.py  # Creator API AES-128-CBC signature\n├── constants.py        # URLs, User-Agent, Chrome version, SDK config\n├── exceptions.py       # Structured exception hierarchy (6 error types)\n├── qr_login.py         # QR code login (browser-assisted terminal QR + HTTP fallback)\n├── formatter.py        # Output formatting, schema envelope, Rich rendering\n└── commands\u002F\n    ├── _common.py      # Shared CLI helpers (structured_output_options, etc.)\n    ├── auth.py         # login\u002Flogout\u002Fstatus\u002Fwhoami\n    ├── reading.py      # search\u002Fread\u002Fcomments\u002Fuser\u002Ffeed\u002Fhot\u002Ftopics\u002Fsearch-user\n    ├── interactions.py  # like\u002Ffavorite\u002Fcomment\u002Freply\u002Fdelete-comment\n    ├── social.py       # follow\u002Funfollow\u002Ffavorites\n    ├── creator.py      # post\u002Fmy-notes\u002Fdelete\n    └── notifications.py # unread\u002Fnotifications\n```\n\n## Development\n\n```bash\n# Install dependencies\nuv sync\n\n# Run tests\nuv run pytest tests\u002F -v\n\n# Unit tests only (no network)\nuv run pytest tests\u002F -v --ignore=tests\u002Ftest_integration.py -m \"not smoke\"\n\n# Smoke tests (need cookies)\nuv run pytest tests\u002F -v -m smoke\n\n# Integration tests (need cookies)\nuv run pytest tests\u002Ftest_integration.py -v\n\n# Lint\nuv run ruff check .\n```\n\n## Troubleshooting\n\n**Q: `NoCookieError: No 'a1' cookie found`**\n\n1. Open any browser and visit https:\u002F\u002Fwww.xiaohongshu.com\u002F\n2. Log in with your account\n3. Run `xhs login` (auto-detects browser) or `xhs login --cookie-source \u003Cbrowser>`\n\n**Q: `NeedVerifyError: Captcha required`**\n\nXHS has triggered a captcha check. Open https:\u002F\u002Fwww.xiaohongshu.com\u002F in your browser, complete the captcha, then retry.\n\n**Q: `IpBlockedError: IP blocked by XHS`**\n\nTry a different network (e.g., mobile hotspot or VPN). XHS blocks IPs that make too many requests.\n\n**Q: `SessionExpiredError: Session expired`**\n\nYour cookies have expired. Run `xhs login` to refresh.\n\n**Q: Requests are slow**\n\nThe built-in Gaussian jitter delay (~1-1.5s between requests) is intentional to mimic natural browsing and avoid triggering XHS's risk control. Aggressive request patterns may lead to captcha triggers or IP blocks.\n\n---\n\n## 推荐项目\n\n- [bilibili-cli](https:\u002F\u002Fgithub.com\u002Fjackwener\u002Fbilibili-cli) — Bilibili 视频、用户、搜索与动态 CLI\n- [twitter-cli](https:\u002F\u002Fgithub.com\u002Fjackwener\u002Ftwitter-cli) — Twitter\u002FX 时间线、书签和发推 CLI\n- [discord-cli](https:\u002F\u002Fgithub.com\u002Fjackwener\u002Fdiscord-cli) — Discord 本地优先同步、检索与导出 CLI\n- [tg-cli](https:\u002F\u002Fgithub.com\u002Fjackwener\u002Ftg-cli) — Telegram 本地优先同步、检索与导出 CLI\n\n## 功能特性\n\n- 🔐 **认证** — 自动提取浏览器 Cookie，browser-assisted 二维码扫码登录，状态检查，用户信息\n- 🔍 **搜索** — 按关键词搜索笔记、用户、话题\n- 📖 **阅读** — 笔记详情、评论、子评论、用户主页\n- 📰 **发现** — 推荐 Feed、按分类浏览热门\n- 👥 **社交** — 关注\u002F取关、收藏夹\n- 👍 **互动** — 点赞、收藏、评论、回复、删除\n- ✍️ **创作者** — 发布图文笔记、我的笔记列表、删除\n- 🔔 **通知** — 未读数、@、点赞、新关注\n- 🛡️ **反风控** — macOS Chrome 指纹一致性、session 级浏览器身份持久化、高斯抖动延迟、验证码自动冷却、指数退避重试\n- 📊 **结构化输出** — `--yaml` \u002F `--json`，非 TTY 默认输出 YAML\n- 📦 **稳定 envelope** — 参见 [SCHEMA.md](.\u002FSCHEMA.md)\n\n## 安装\n\n```bash\n# 推荐：uv tool（快速、隔离环境）\nuv tool install xiaohongshu-cli\n\n# 或者：pipx\npipx install xiaohongshu-cli\n```\n\n升级到最新版本：\n\n```bash\nuv tool upgrade xiaohongshu-cli\n# 或：pipx upgrade xiaohongshu-cli\n```\n\n> **提示：** 建议定期升级，避免因版本过旧导致的 API 调用异常。\n\n从源码安装：\n\n```bash\ngit clone git@github.com:jackwener\u002Fxiaohongshu-cli.git\ncd xiaohongshu-cli\nuv sync\n```\n\n## 使用示例\n\n```bash\n# 认证\nxhs login                             # 从浏览器提取 Cookie\nxhs login --qrcode                    # browser-assisted 二维码扫码登录（终端显示二维码）\nxhs status                            # 检查登录状态\nxhs whoami                            # 查看用户资料\nxhs logout                            # 清除缓存的 Cookie\n\n# 搜索\nxhs search \"美食\"                      # 搜索笔记\nxhs search \"旅行\" --sort popular       # 排序：general, popular, latest\nxhs search-user \"用户名\"               # 搜索用户\nxhs topics \"美食\"                      # 搜索话题\n\n# 阅读\nxhs read 1                             # 阅读最近一次列表里的第 1 条笔记\nxhs read \u003Cnote_id>                     # 阅读笔记（仅走 API）\nxhs read \"https:\u002F\u002F...?xsec_token=...\"  # 粘贴网页 URL 直接阅读（使用 URL token）\nxhs comments 1                         # 查看最近一次列表里的第 1 条笔记评论\nxhs comments \"\u003Curl>\"                   # 查看评论 — 粘贴 URL 以缓存\u002F复用 xsec_token\nxhs comments \"\u003Curl>\" --all             # 获取全部评论（自动翻页）\nxhs comments \"\u003Curl>\" --all --json      # 全部评论，JSON 格式\nxhs comments \u003Cnote_id> --xsec-token T  # 用 note_id + 显式 xsec_token\nxhs comments \u003Cnote_id>                 # 如果之前访问过 URL，会复用缓存 token\nxhs sub-comments \u003Cnote_id> \u003Ccmt_id>   # 查看评论的回复\nxhs user \u003Cuser_id>                     # 用户主页\nxhs user-posts \u003Cuser_id>              # 用户发布的笔记\n\n# 发现\nxhs feed                              # 推荐 Feed\nxhs hot -c food                       # 热门笔记（按分类）\nxhs hot -c travel                     # 分类: fashion, food, cosmetics, movie, career,\n                                      #       love, home, gaming, travel, fitness\n\n# 社交\nxhs favorites                          # 我的收藏（自动识别当前用户）\nxhs favorites \u003Cuser_id>                # 其他用户的收藏\nxhs likes                            # 我的点赞（自动识别当前用户）\nxhs likes \u003Cuser_id>                  # 其他用户的点赞\nxhs follow \u003Cuser_id>                   # 关注\nxhs unfollow \u003Cuser_id>                 # 取消关注\n\n# 互动\nxhs like 1                             # 给最近一次列表里的第 1 条笔记点赞\nxhs like \u003Cnote_id>                     # 点赞\nxhs like \u003Cnote_id> --undo              # 取消点赞\nxhs favorite 1                         # 收藏最近一次列表里的第 1 条笔记\nxhs favorite \u003Cnote_id>                 # 收藏\nxhs unfavorite 1                       # 取消收藏最近一次列表里的第 1 条笔记\nxhs unfavorite \u003Cnote_id>               # 取消收藏\nxhs comment 1 -c \"好棒！\"              # 给最近一次列表里的第 1 条笔记发评论\nxhs comment \u003Cnote_id> -c \"好棒！\"      # 发评论\nxhs reply 1 --comment-id X -c \"谢谢\"   # 给最近一次列表里的第 1 条笔记回复评论\nxhs reply \u003Cnote_id> --comment-id X -c \"谢谢\"  # 回复评论\nxhs delete-comment \u003Cnote_id> \u003Ccmt_id>  # 删除自己的评论\n\n# 创作者\nxhs my-notes                           # 我的笔记列表\nxhs post --title \"标题\" --body \"正文\" --images img.jpg  # 发布笔记\nxhs delete \u003Cnote_id>                   # 删除笔记\nxhs delete \u003Cnote_id> -y                # 跳过确认\n\n# 通知\nxhs unread                             # 未读数\nxhs notifications                      # 评论和 @ 通知\nxhs notifications --type likes         # 赞和收藏通知\nxhs notifications --type connections   # 新增关注通知\n```\n\n## 认证策略\n\nxiaohongshu-cli 支持多种认证方式：\n\n1. **已保存 Cookie** — 从 `~\u002F.xiaohongshu-cli\u002Fcookies.json` 加载\n2. **浏览器 Cookie** — 自动检测已安装浏览器并提取（支持 Chrome、Arc、Edge、Firefox、Safari、Brave、Chromium、Opera、Vivaldi 等）\n3. **二维码扫码登录** — browser-assisted 登录，终端显示二维码，用小红书 App 扫码（`xhs login --qrcode`）\n\nCookie 保存后有效期 **7 天**，超时后自动尝试从浏览器刷新。\n\n`xhs login` 会自动尝试所有已安装浏览器，使用第一个有有效 Cookie 的浏览器。也可用 `--cookie-source \u003Cbrowser>` 指定浏览器，或 `--qrcode` 使用 browser-assisted 二维码登录。其他需认证命令在 session 过期时会自动重试一次。\n\n## 常见问题\n\n- `NoCookieError: No 'a1' cookie found` — 请先在任意浏览器打开 https:\u002F\u002Fwww.xiaohongshu.com\u002F 并登录，然后执行 `xhs login`\n- `NeedVerifyError` — 触发了验证码，请到浏览器中完成验证后重试\n- `IpBlockedError` — IP 被限制，尝试切换网络（手机热点或 VPN）\n- `SessionExpiredError` — Cookie 过期，执行 `xhs login` 刷新\n- 请求较慢是正常的 — 内置高斯随机延迟（~1-1.5s）是为了模拟人类浏览行为，避免触发风控\n\n## 作为 AI Agent Skill 使用\n\nxiaohongshu-cli 自带 [`SKILL.md`](.\u002FSKILL.md)，让 AI Agent 能自动学习并使用本工具。\n\n### [Skills CLI](https:\u002F\u002Fgithub.com\u002Fvercel-labs\u002Fskills)（推荐）\n\n```bash\nnpx skills add jackwener\u002Fxiaohongshu-cli\n```\n\n| 参数 | 说明 |\n| --- | --- |\n| `-g` | 全局安装（用户级别，跨项目共享） |\n| `-a claude-code` | 指定目标 Agent |\n| `-y` | 非交互模式 |\n\n### 手动安装\n\n```bash\nmkdir -p .agents\u002Fskills\ngit clone git@github.com:jackwener\u002Fxiaohongshu-cli.git .agents\u002Fskills\u002Fxiaohongshu-cli\n```\n\n### ~~OpenClaw \u002F ClawHub~~（已过时）\n\n> ⚠️ ClawHub 安装方式已过时，不再支持。请使用上方的 Skills CLI 或手动安装。\n\n## License\n\nApache-2.0\n","xiaohongshu-cli 是一个用于小红书的命令行工具，支持搜索、阅读和互动等功能。该项目通过逆向工程API实现了包括自动提取浏览器cookies登录、笔记和用户搜索、阅读笔记详情与评论、点赞收藏及发布图文笔记等核心功能。技术上，它采用了Python语言开发，并且具备了结构化输出（支持YAML和JSON格式）以及反检测机制来保证使用的稳定性和安全性。适合需要批量操作小红书内容或希望以编程方式与小红书平台交互的开发者使用。",2,"2026-06-11 03:49:27","high_star"]