xiaohongshu-publish-and-data
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese编排入口:多 skill 组合流程请使用总控 skill 与media-managerCLI。本 skill 为 deep-dive。media
编排入口:多 skill 组合流程请使用总控 skill 与media-managerCLI。本 skill 为深度解析技能。media
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.
- 通过连接CDP的真实Chrome浏览器,从Markdown文件或明确的CLI输入发布小红书图文笔记。
- 确认CDP Chrome会话可访问创作者发布页面。
- 通过Playwright + 保存的认证状态获取近期发布笔记的表现数据(浏览量、点赞数、评论数、收藏数、分享数)。
请勿将本技能用于基于密码的登录自动化、验证码绕过、二维码自动化、视频发布、定时发布、仅草稿流程或多账号编排。
Runtime Requirement
运行环境要求
Publishing requires a logged-in real Chrome started with remote debugging and .
--cdp-urlDo not document or recommend publishing with only and a Playwright-launched browser. That path cannot reliably click the button on Xiaohongshu creator center.
--state发布发布功能必须使用已登录且开启远程调试的真实Chrome浏览器,并指定参数。
--cdp-url请勿记录或推荐仅使用参数和Playwright启动的浏览器进行发布。该方式无法可靠点击小红书创作者中心的「发布」按钮。
--stateCLI(推荐)
CLI(推荐)
执行前先 。
media workspace show| 操作 | 命令 |
|---|---|
| 发布图文笔记 | |
| 抓取笔记数据 | |
| 导出登录态 | |
| 检查登录 | |
执行前先运行。
media workspace show| 操作 | 命令 |
|---|---|
| 发布图文笔记 | |
| 抓取笔记数据 | |
| 导出登录态 | |
| 检查登录 | |
Resolve Paths And Runtime(Deep-dive)
路径解析与运行机制(深度解析)
Determine this SKILL.md directory as {baseDir}. Prefer above.
media xhs ...将本SKILL.md所在目录视为{baseDir}。优先使用上述命令。
media xhs ...Choose The Workflow
选择工作流
- Publish image-note: +
post-note.ts--cdp-url - Fetch note analytics: +
fetch-analytics.ts(Playwright, no CDP required)--state - Optional environment check:
check-environment.ts
Run one-time setup only when dependencies are missing or Chrome/CDP is not configured yet.
- 发布图文笔记:+
post-note.ts--cdp-url - 获取笔记分析数据:+
fetch-analytics.ts(基于Playwright,无需CDP)--state - 可选环境检查:
check-environment.ts
仅当依赖缺失或Chrome/CDP未配置时,才执行一次性设置。
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-urlbash
cd {baseDir}/scripts
npm install
npx tsx check-environment.tstext
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-urlbash
cd {baseDir}/scripts
npm install
npx tsx check-environment.tsStart Chrome With CDP (required before every publish session)
启动带CDP的Chrome(每次发布前必须执行)
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先关闭所有Chrome窗口,再启动开启远程调试的Chrome。
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"如果主Chrome配置文件已打开,请使用专用的配置文件目录。
可通过环境变量替代重复输入参数:
bash
export XHS_CDP_URL=http://127.0.0.1:9222Recurring 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 warningsRecommended command:
bash
media xhs post-note --file output/{slug}/note.md --cdp-url http://127.0.0.1:9222Rules:
- Pass Xiaohongshu-ready Markdown directly when using .
--file - 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 .
{baseDir}/xhs-output/
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推荐命令:
bash
media xhs post-note --file output/{slug}/note.md --cdp-url http://127.0.0.1:9222规则:
- 使用参数时,直接传入符合小红书格式的Markdown文件。
--file - 请勿在本技能内将长篇文章Markdown转换为小红书格式。
- 通过Chrome无障碍功能+CDP点击红色「发布」按钮立即发布;不使用「暂存离开」功能。
- 小红书网页草稿为浏览器本地存储,本技能不支持。
- 笔记内容不能为空;如果前置元数据中没有内容,脚本将使用标题作为默认描述。
- 若发布失败,请检查警告信息(点击方式、验证提示框)以及目录下的失败截图。
{baseDir}/xhs-output/
Recurring Workflow: Fetch Note Analytics
常规工作流:获取笔记分析数据
Uses Playwright with saved (same auth export flow as other platforms). No CDP Chrome required.
storageState.jsonbash
media xhs analytics fetchDefault output: (works regardless of current working directory).
{baseDir}/xhs-output/xhs-analytics-YYYYMMDD-HHMMSS.jsonUse only when debugging API changes or parser issues; routine analyze-operation runs do not need raw payloads.
--save-rawCaptured fields per note:
- title, url, publishTime
- viewCount, commentCount, likeCount, collectCount, shareCount
Data source: creator note manager API ().
/api/galaxy/v2/creator/note/user/posted使用Playwright和保存的(与其他平台相同的认证导出流程),无需CDP Chrome。
storageState.jsonbash
media xhs analytics fetch默认输出文件:(不受当前工作目录影响)。
{baseDir}/xhs-output/xhs-analytics-YYYYMMDD-HHMMSS.json仅在调试API变更或解析器问题时使用参数;常规分析操作无需保存原始 payload。
--save-raw每条笔记采集的字段:
- 标题、链接、发布时间
- 浏览量、评论数、点赞数、收藏数、分享数
数据来源:创作者笔记管理API()。
/api/galaxy/v2/creator/note/user/postedReferences
参考资料
- 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
- 首次配置:references/config/first-time-setup.md
- 发布细节:references/article-posting.md
- 输出格式:references/output-format.md
- 故障排查:references/troubleshooting/common-issues.md
- Linux相关说明:references/ubuntu/headless-setup.md
内容撰写规则:../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 ,
.auth/, or output artifacts into git..chrome-cdp-profile/ - is ignored with a warning; this skill publishes directly.
--draft - If Xiaohongshu introduces new required fields, stop after surfacing the missing selector or warning instead of guessing hidden values.
- 自动化过程中请勿索要账号密码、短信验证码或登录二维码密钥。
- 请勿将、
.auth/或输出产物提交至git。.chrome-cdp-profile/ - 参数将被忽略并给出警告;本技能直接发布内容。
--draft - 若小红书新增必填字段,应提示缺失的选择器或警告,而非猜测隐藏值。