编排入口:多 skill 组合流程请使用
总控 skill 与
CLI。本 skill 为 deep-dive。
Xiaohongshu Publish And Data
Language
Match the user's language.
Use This Skill For
- Publish a Xiaohongshu image-note from Markdown or explicit CLI inputs through CDP-attached real Chrome.
- Confirm the CDP Chrome session can reach the creator publish page.
- Fetch recent published note performance metrics (views, likes, comments, collects, shares) via Playwright + saved auth state.
Do not use this skill for password-based login automation, CAPTCHA bypass, QR automation, video publishing, scheduled publishing, draft-only workflows, or multi-account orchestration.
Runtime Requirement
Publishing
requires a logged-in real Chrome started with remote debugging and
.
Do
not document or recommend publishing with only
and a Playwright-launched browser. That path cannot reliably click the
button on Xiaohongshu creator center.
CLI(推荐)
| 操作 | 命令 |
|---|
| 发布图文笔记 | media xhs post-note --file output/{slug}/note.md --cdp-url http://127.0.0.1:9222
|
| 抓取笔记数据 | media xhs analytics fetch
|
| 导出登录态 | |
| 检查登录 | |
Resolve Paths And Runtime(Deep-dive)
Determine this SKILL.md directory as {baseDir}. Prefer
above.
Choose The Workflow
- Publish image-note: +
- Fetch note analytics: + (Playwright, no CDP required)
- Optional environment check:
Run one-time setup only when dependencies are missing or Chrome/CDP is not configured yet.
One-Time Setup
text
One-Time Setup Progress:
- [ ] Step 1: Install dependencies in {baseDir}/scripts
- [ ] Step 2: Install Google Chrome (not Playwright-only Chromium for publish)
- [ ] Step 3: Log in to https://creator.xiaohongshu.com/ in your Chrome profile
- [ ] Step 4: Learn the CDP launch command for your OS
- [ ] Step 5: Run one successful publish with --cdp-url
bash
cd {baseDir}/scripts
npm install
npx tsx check-environment.ts
Start Chrome With CDP (required before every publish session)
Close all Chrome windows first, then start Chrome with remote debugging.
Windows (PowerShell):
powershell
& "C:\Program Files\Google\Chrome\Application\chrome.exe" `
--remote-debugging-port=9222 `
--user-data-dir="$env:LOCALAPPDATA\Google\Chrome\User Data"
macOS:
bash
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--remote-debugging-port=9222 \
--user-data-dir="$HOME/Library/Application Support/Google/Chrome"
Linux:
bash
google-chrome \
--remote-debugging-port=9222 \
--user-data-dir="$HOME/.config/google-chrome"
Use a dedicated profile directory if your main Chrome profile is already open.
Optional environment variable instead of repeating the flag:
bash
export XHS_CDP_URL=http://127.0.0.1:9222
Recurring Workflow: Publish Image-Note
text
Publish Workflow Progress:
- [ ] Step 1: Start logged-in Chrome with --remote-debugging-port=9222
- [ ] Step 2: Run post-note.ts with --file or explicit --images/--title/--note and --cdp-url
- [ ] Step 3: Confirm success from JSON output (POST web_api/sns/v2/note or success URL)
- [ ] Step 4: Report result files and warnings
Recommended command:
bash
media xhs post-note --file output/{slug}/note.md --cdp-url http://127.0.0.1:9222
Rules:
- Pass Xiaohongshu-ready Markdown directly when using .
- Do not convert long-form article Markdown into Xiaohongshu format inside this skill.
- Publishes immediately by clicking the red button via Chrome Accessibility + CDP; does not use .
- Xiaohongshu web drafts are browser-local and not supported.
- Note body must not be empty; if frontmatter has no body, the script uses the title as default description.
- If publish fails, inspect warnings (click method, validation toast) and the failure screenshot in .
Recurring Workflow: Fetch Note Analytics
Uses Playwright with saved
(same auth export flow as other platforms). No CDP Chrome required.
bash
media xhs analytics fetch
Default output:
{baseDir}/xhs-output/xhs-analytics-YYYYMMDD-HHMMSS.json
(works regardless of current working directory).
Use
only when debugging API changes or parser issues; routine analyze-operation runs do not need raw payloads.
Captured fields per note:
- title, url, publishTime
- viewCount, commentCount, likeCount, collectCount, shareCount
Data source: creator note manager API (
/api/galaxy/v2/creator/note/user/posted
).
References
- First-time config: references/config/first-time-setup.md
- Publishing details: references/article-posting.md
- Output schema: references/output-format.md
- Troubleshooting: references/troubleshooting/common-issues.md
- Linux notes: references/ubuntu/headless-setup.md
Content writing rules: ../guidance/writing/platform/xiaohongshu.md
Safety And Boundaries
- Do not ask for account password, SMS code, or login QR secrets in automation.
- Do not commit , , or output artifacts into git.
- is ignored with a warning; this skill publishes directly.
- If Xiaohongshu introduces new required fields, stop after surfacing the missing selector or warning instead of guessing hidden values.