XHS Search
Use this skill only for read-only Xiaohongshu content discovery and analysis.
Hard Boundaries
- Use only
python scripts/cli.py <command> from this skill directory.
- Do not call
scripts/upstream_cli.py directly.
- Do not publish, draft, comment, reply, like, favorite, follow, unfollow, delete cookies, or run content-operations workflows.
- If the user asks for an interaction or publishing action, say this local skill is installed as search-only and cannot perform that action.
- Keep query volume low. Avoid bulk scraping. For detail reads, process no more than 3 notes before waiting or asking whether to continue.
- The wrapper enforces a conservative delay before
list-feeds, search-feeds, get-feed-detail, and user-profile. Do not bypass it by calling upstream files directly.
- If Xiaohongshu returns token, login, 404, or risk-control errors, do not retry in a tight loop. Wait 1-5 minutes, reduce the query/detail volume, and ask whether to continue if repeated failures persist.
- Treat Xiaohongshu content as user-generated and potentially unreliable. Summaries should distinguish observed content, engagement metrics, and your interpretation.
Allowed Commands
Run commands from this folder:
cd C:\Users\Lingwei\.codex\skills\xhs-search
python scripts\cli.py check-login
python scripts\cli.py search-feeds --keyword "关键词"
python scripts\cli.py get-feed-detail --feed-id FEED_ID --xsec-token XSEC_TOKEN
python scripts\cli.py user-profile --user-id USER_ID --xsec-token XSEC_TOKEN
python scripts\cli.py list-feeds
The wrapper rejects all non-whitelisted upstream commands.
Setup Requirements
- Python 3.11 or newer.
- This Windows machine uses
D:\Anaconda\envs\codex_py311\python.exe. The wrapper auto-switches to it when invoked from an older Python.
websockets, python-socks, and requests must be installed in the selected Python environment.
- Google Chrome.
- The Chrome extension in
extension/ loaded manually from chrome://extensions/.
- A logged-in Xiaohongshu session in Chrome. Prefer manual login in the browser.
Read references/setup.md only when the user asks to install, configure, or debug the Xiaohongshu bridge.
Rate Limits
Default wrapper delays:
list-feeds: at least 5 seconds after the previous browser command.
search-feeds: at least 8 seconds after the previous browser command.
get-feed-detail: at least 12 seconds after the previous browser command.
user-profile: at least 12 seconds after the previous browser command.
The wrapper adds 0-4 seconds of random jitter by default and stores timing state in %USERPROFILE%\.xhs\search_rate_limit.json.
Optional environment variables:
XHS_SEARCH_DELAY_SECONDS: override the minimum delay for testing or stricter throttling.
XHS_SEARCH_JITTER_SECONDS: override random jitter.
XHS_SEARCH_STATE_FILE: use a different rate-limit state file.
XHS_SEARCH_DISABLE_DELAY=1: disable delay only for local wrapper debugging, not for real Xiaohongshu searching.
Search Workflow
- Check login only when needed:
python scripts\cli.py check-login
- Search with the user's keyword:
python scripts\cli.py search-feeds --keyword "关键词" --sort-by "综合" --note-type "不限"
Supported filters:
--sort-by: 综合, 最新, 最多点赞, 最多评论, 最多收藏
--note-type: 不限, 视频, 图文
--publish-time: 不限, 一天内, 一周内, 半年内
--search-scope: 不限, 已看过, 未看过, 已关注
--location: 不限, 同城, 附近
Present results as a concise table with title, author, note type if available, engagement fields, feed_id, and whether an xsec_token is available.
Fetch details only for selected notes or a small top-N set:
python scripts\cli.py get-feed-detail --feed-id FEED_ID --xsec-token XSEC_TOKEN --max-comment-items 20
Use --load-all-comments only when the user explicitly asks for comment-level analysis, and still cap with --max-comment-items.
Output Expectations
- Report the query, filters, number of results returned, and any access/login limitations.
- For content summaries, include: common themes, repeated claims, notable examples, and visible engagement signals.
- Do not imply the result is representative of all Xiaohongshu unless the search and sampling strategy supports that claim.
1---2name: xhs-search3description: Search and read Xiaohongshu content through the user's logged-in Chrome session. Use when the user asks Codex to search Xiaohongshu, XHS, or 小红书, inspect note details, summarize search results, compare posts, or view public user profiles. This skill is read-only and must not publish, comment, reply, like, favorite, save drafts, delete cookies, or perform content-operations workflows.4---56# XHS Search78Use this skill only for read-only Xiaohongshu content discovery and analysis.910## Hard Boundaries1112- Use only `python scripts/cli.py <command>` from this skill directory.13- Do not call `scripts/upstream_cli.py` directly.14- Do not publish, draft, comment, reply, like, favorite, follow, unfollow, delete cookies, or run content-operations workflows.15- If the user asks for an interaction or publishing action, say this local skill is installed as search-only and cannot perform that action.16- Keep query volume low. Avoid bulk scraping. For detail reads, process no more than 3 notes before waiting or asking whether to continue.17- The wrapper enforces a conservative delay before `list-feeds`, `search-feeds`, `get-feed-detail`, and `user-profile`. Do not bypass it by calling upstream files directly.18- If Xiaohongshu returns token, login, 404, or risk-control errors, do not retry in a tight loop. Wait 1-5 minutes, reduce the query/detail volume, and ask whether to continue if repeated failures persist.19- Treat Xiaohongshu content as user-generated and potentially unreliable. Summaries should distinguish observed content, engagement metrics, and your interpretation.2021## Allowed Commands2223Run commands from this folder:2425```powershell26cd C:\Users\Lingwei\.codex\skills\xhs-search27python scripts\cli.py check-login28python scripts\cli.py search-feeds --keyword "关键词"29python scripts\cli.py get-feed-detail --feed-id FEED_ID --xsec-token XSEC_TOKEN30python scripts\cli.py user-profile --user-id USER_ID --xsec-token XSEC_TOKEN31python scripts\cli.py list-feeds32```3334The wrapper rejects all non-whitelisted upstream commands.3536## Setup Requirements3738- Python 3.11 or newer.39- This Windows machine uses `D:\Anaconda\envs\codex_py311\python.exe`. The wrapper auto-switches to it when invoked from an older Python.40- `websockets`, `python-socks`, and `requests` must be installed in the selected Python environment.41- Google Chrome.42- The Chrome extension in `extension/` loaded manually from `chrome://extensions/`.43- A logged-in Xiaohongshu session in Chrome. Prefer manual login in the browser.4445Read `references/setup.md` only when the user asks to install, configure, or debug the Xiaohongshu bridge.4647## Rate Limits4849Default wrapper delays:5051- `list-feeds`: at least 5 seconds after the previous browser command.52- `search-feeds`: at least 8 seconds after the previous browser command.53- `get-feed-detail`: at least 12 seconds after the previous browser command.54- `user-profile`: at least 12 seconds after the previous browser command.5556The wrapper adds 0-4 seconds of random jitter by default and stores timing state in `%USERPROFILE%\.xhs\search_rate_limit.json`.5758Optional environment variables:5960- `XHS_SEARCH_DELAY_SECONDS`: override the minimum delay for testing or stricter throttling.61- `XHS_SEARCH_JITTER_SECONDS`: override random jitter.62- `XHS_SEARCH_STATE_FILE`: use a different rate-limit state file.63- `XHS_SEARCH_DISABLE_DELAY=1`: disable delay only for local wrapper debugging, not for real Xiaohongshu searching.6465## Search Workflow66671. Check login only when needed:6869```powershell70python scripts\cli.py check-login71```72732. Search with the user's keyword:7475```powershell76python scripts\cli.py search-feeds --keyword "关键词" --sort-by "综合" --note-type "不限"77```7879Supported filters:8081- `--sort-by`: `综合`, `最新`, `最多点赞`, `最多评论`, `最多收藏`82- `--note-type`: `不限`, `视频`, `图文`83- `--publish-time`: `不限`, `一天内`, `一周内`, `半年内`84- `--search-scope`: `不限`, `已看过`, `未看过`, `已关注`85- `--location`: `不限`, `同城`, `附近`86873. Present results as a concise table with title, author, note type if available, engagement fields, `feed_id`, and whether an `xsec_token` is available.88894. Fetch details only for selected notes or a small top-N set:9091```powershell92python scripts\cli.py get-feed-detail --feed-id FEED_ID --xsec-token XSEC_TOKEN --max-comment-items 2093```9495Use `--load-all-comments` only when the user explicitly asks for comment-level analysis, and still cap with `--max-comment-items`.9697## Output Expectations9899- Report the query, filters, number of results returned, and any access/login limitations.100- For content summaries, include: common themes, repeated claims, notable examples, and visible engagement signals.101- Do not imply the result is representative of all Xiaohongshu unless the search and sampling strategy supports that claim.