Skill flagged — review recommended

ClawHub Security found sensitive or high-impact capabilities. Review the scan results before using.

Baoyu Post To Xhs

v1.2.0

Posts image-text notes to Xiaohongshu (小红书) via Chrome CDP. Supports uploading multiple images, filling title/description, adding topics, and optional auto-s...

0· 304· 3 versions· 0 current· 0 all-time· Updated 19h ago· MIT-0

Install

openclaw skills install baoyu-post-to-xhs

Post to Xiaohongshu (小红书)

Posts image-text notes to Xiaohongshu via real Chrome browser (bypasses anti-bot detection).

Language

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.

Script Directory

Important: All scripts are located in the scripts/ subdirectory of this skill.

Agent Execution Instructions:

  1. Determine this SKILL.md file's directory path as {baseDir}
  2. Script path = {baseDir}/scripts/<script-name>.ts
  3. Replace all {baseDir} in this document with the actual path
  4. Resolve ${BUN_X} runtime: if bun installed → bun; if npx available → npx -y bun; else suggest installing bun

Script Reference:

ScriptPurpose
scripts/xhs-browser.tsImage-text note publishing
scripts/check-permissions.tsVerify environment & permissions

Preferences (EXTEND.md)

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

Prerequisites

  • Google Chrome or Chromium
  • bun runtime
  • First run: log in to Xiaohongshu manually in the browser (session saved)

Pre-flight Check (Optional)

Before 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:

CheckFix
ChromeInstall Chrome or set XHS_BROWSER_CHROME_PATH env var
Profile dirShared profile at baoyu-skills/chrome-profile
Bun runtimenpm install -g bun or brew install oven-sh/bun/bun (macOS)

Image-Text Note Posting (图文笔记)

${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:

ParameterDescription
--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)
--submitActually publish (default: preview only)
--profile <dir>Custom Chrome profile directory
--helpShow 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.


Publishing Workflow

Step 1: Prepare Content

Input TypeDetectionAction
Markdown file--markdown <path>Extract title from H1, content from body
Direct input--title + --contentUse as-is
Images dir--images <dir>Load all images from directory

Step 2: Launch Browser & Login

  1. Launch Chrome with dedicated profile
  2. Navigate to https://creator.xiaohongshu.com/publish/publish
  3. If not logged in → prompt user to scan QR code
  4. Wait for login (up to 2 minutes timeout)

Step 3: Upload Images

  1. Find the image upload area on the publish page
  2. Use DOM.setFileInputFiles or file chooser interception to upload images
  3. Wait for upload completion (verify thumbnail count)

Step 4: Fill Content

  1. Fill title in the title input
  2. Fill description/content in the editor
  3. Add topics/hashtags if provided

Step 5: Submit or Preview

  • Default: leave browser open for user review
  • With --submit: click the publish button

Troubleshooting

IssueSolution
Chrome debug port not readyKill existing Chrome CDP instances and retry
Not logged inFirst run opens browser — scan QR code to log in
Chrome not foundSet XHS_BROWSER_CHROME_PATH env var
Image upload failsCheck file exists and is a valid image format
Title too longTitle auto-compressed to 20 chars
Content too longContent auto-compressed to 1000 chars

Chrome debug port not ready

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.

Notes

  • First run: manual login required (session persists in Chrome profile)
  • All scripts fill content into the browser; user must review and publish manually unless --submit is used
  • Cross-platform: macOS, Linux, Windows
  • Xiaohongshu publish page: https://creator.xiaohongshu.com/publish/publish

Extension Support

Custom configurations via EXTEND.md. See Preferences section for paths and supported options.

Version tags

latestvk972cegdrnannyfc0ew2429sqh84g8br

Runtime requirements

Any binbun, npx