Install
openclaw skills install baoyu-post-to-xhsPosts image-text notes to Xiaohongshu (小红书) via Chrome CDP. Supports uploading multiple images, filling title/description, adding topics, and optional auto-s...
openclaw skills install baoyu-post-to-xhsPosts image-text notes to Xiaohongshu via real Chrome browser (bypasses anti-bot detection).
Match user's language: Respond in the same language the user uses. If user writes in Chinese, respond in Chinese. If user writes in English, respond in English.
Important: All scripts are located in the scripts/ subdirectory of this skill.
Agent Execution Instructions:
{baseDir}{baseDir}/scripts/<script-name>.ts{baseDir} in this document with the actual path${BUN_X} runtime: if bun installed → bun; if npx available → npx -y bun; else suggest installing bunScript Reference:
| Script | Purpose |
|---|---|
scripts/xhs-browser.ts | Image-text note publishing |
scripts/check-permissions.ts | Verify environment & permissions |
Check EXTEND.md existence (priority order):
# macOS, Linux, WSL, Git Bash
test -f .baoyu-skills/baoyu-post-to-xhs/EXTEND.md && echo "project"
test -f "${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-post-to-xhs/EXTEND.md" && echo "xdg"
test -f "$HOME/.baoyu-skills/baoyu-post-to-xhs/EXTEND.md" && echo "user"
# PowerShell (Windows)
if (Test-Path .baoyu-skills/baoyu-post-to-xhs/EXTEND.md) { "project" }
$xdg = if ($env:XDG_CONFIG_HOME) { $env:XDG_CONFIG_HOME } else { "$HOME/.config" }
if (Test-Path "$xdg/baoyu-skills/baoyu-post-to-xhs/EXTEND.md") { "xdg" }
if (Test-Path "$HOME/.baoyu-skills/baoyu-post-to-xhs/EXTEND.md") { "user" }
┌──────────────────────────────────────────────────────┬───────────────────┐ │ Path │ Location │ ├──────────────────────────────────────────────────────┼───────────────────┤ │ .baoyu-skills/baoyu-post-to-xhs/EXTEND.md │ Project directory │ ├──────────────────────────────────────────────────────┼───────────────────┤ │ $HOME/.baoyu-skills/baoyu-post-to-xhs/EXTEND.md │ User home │ └──────────────────────────────────────────────────────┴───────────────────┘
┌───────────┬───────────────────────────────────────────────────────────────────────────┐ │ Result │ Action │ ├───────────┼───────────────────────────────────────────────────────────────────────────┤ │ Found │ Read, parse, apply settings │ ├───────────┼───────────────────────────────────────────────────────────────────────────┤ │ Not found │ Use defaults │ └───────────┴───────────────────────────────────────────────────────────────────────────┘
EXTEND.md Supports: Default Chrome profile path
Recommended EXTEND.md example:
chrome_profile_path: /path/to/chrome/profile
bun runtimeBefore first use, suggest running the environment check. User can skip if they prefer.
${BUN_X} {baseDir}/scripts/check-permissions.ts
Checks: Chrome, profile isolation, Bun.
If any check fails, provide fix guidance per item:
| Check | Fix |
|---|---|
| Chrome | Install Chrome or set XHS_BROWSER_CHROME_PATH env var |
| Profile dir | Shared profile at baoyu-skills/chrome-profile |
| Bun runtime | npm install -g bun or brew install oven-sh/bun/bun (macOS) |
${BUN_X} {baseDir}/scripts/xhs-browser.ts --title "标题" --content "描述" --image img1.png --image img2.png
${BUN_X} {baseDir}/scripts/xhs-browser.ts --markdown article.md --images ./photos/
${BUN_X} {baseDir}/scripts/xhs-browser.ts --title "标题" --content "描述" --images ./photos/ --topic "话题1" --topic "话题2" --submit
Parameters:
| Parameter | Description |
|---|---|
--title <text> | Note title (max 20 chars, auto-compressed) |
--content <text> | Note description (max 1000 chars, auto-compressed) |
--markdown <path> | Markdown file for title/content extraction |
--image <path> | Image file (repeatable, max 18) |
--images <dir> | Directory containing images (PNG/JPG/WEBP) |
--topic <text> | Topic/hashtag (repeatable) |
--submit | Actually publish (default: preview only) |
--profile <dir> | Custom Chrome profile directory |
--help | Show help |
Note: By default the script only fills content into the browser. User reviews and publishes manually. Add --submit to auto-publish.
Image Limits: Up to 18 images per note. Supported formats: PNG, JPG, JPEG, WEBP, GIF.
| Input Type | Detection | Action |
|---|---|---|
| Markdown file | --markdown <path> | Extract title from H1, content from body |
| Direct input | --title + --content | Use as-is |
| Images dir | --images <dir> | Load all images from directory |
https://creator.xiaohongshu.com/publish/publishDOM.setFileInputFiles or file chooser interception to upload images--submit: click the publish button| Issue | Solution |
|---|---|
| Chrome debug port not ready | Kill existing Chrome CDP instances and retry |
| Not logged in | First run opens browser — scan QR code to log in |
| Chrome not found | Set XHS_BROWSER_CHROME_PATH env var |
| Image upload fails | Check file exists and is a valid image format |
| Title too long | Title auto-compressed to 20 chars |
| Content too long | Content auto-compressed to 1000 chars |
If a script fails with Chrome debug port not ready, kill existing Chrome CDP instances first, then retry:
pkill -f "Chrome.*remote-debugging-port" 2>/dev/null; sleep 2
# PowerShell (Windows)
Get-Process chrome -ErrorAction SilentlyContinue | Where-Object { $_.CommandLine -match 'remote-debugging-port' } | Stop-Process -Force
Start-Sleep -Seconds 2
Important: This should be done automatically — when encountering this error, kill Chrome CDP instances and retry the command without asking the user.
--submit is usedhttps://creator.xiaohongshu.com/publish/publishCustom configurations via EXTEND.md. See Preferences section for paths and supported options.