← 返回 Skills 市场
praguepp

Baoyu Post To Xhs

作者 praguepp · GitHub ↗ · v1.2.0 · MIT-0
cross-platform ⚠ suspicious
278
总下载
0
收藏
0
当前安装
3
版本数
在 OpenClaw 中安装
/install baoyu-post-to-xhs
功能描述
Posts image-text notes to Xiaohongshu (小红书) via Chrome CDP. Supports uploading multiple images, filling title/description, adding topics, and optional auto-s...
使用说明 (SKILL.md)

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/\x3Cscript-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:

Script Purpose
scripts/xhs-browser.ts Image-text note publishing
scripts/check-permissions.ts Verify 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:

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)

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:

Parameter Description
--title \x3Ctext> Note title (max 20 chars, auto-compressed)
--content \x3Ctext> Note description (max 1000 chars, auto-compressed)
--markdown \x3Cpath> Markdown file for title/content extraction
--image \x3Cpath> Image file (repeatable, max 18)
--images \x3Cdir> Directory containing images (PNG/JPG/WEBP)
--topic \x3Ctext> Topic/hashtag (repeatable)
--submit Actually publish (default: preview only)
--profile \x3Cdir> 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.


Publishing Workflow

Step 1: Prepare Content

Input Type Detection Action
Markdown file --markdown \x3Cpath> Extract title from H1, content from body
Direct input --title + --content Use as-is
Images dir --images \x3Cdir> 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

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

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.

安全使用建议
What to consider before installing: - This skill automates a real Chrome browser and needs access to a browser profile; do not point it at your main Chrome profile if you want to avoid exposing other sessions/cookies. Prefer using a dedicated profile (EXTEND.md can set a custom chrome_profile_path). - The scripts probe and log DOM content (visible text, upload-area HTML, form inputs). That is necessary to locate the upload controls but means page content can be read and printed to the agent console—avoid running it on pages containing sensitive information. - By default the script only fills the form and previews; the --submit flag will auto-publish to your account. Always test with preview mode first. - Running the pre-flight check (scripts/check-permissions.ts) is recommended; it will tell you if bun/npx and Chrome are available and whether node_modules are needed. - The code is bundled with the skill (no external download URLs), but you should still inspect the scripts especially any parts that would auto-submit or attach to non-dedicated profiles. If you are not comfortable, run the tooling in an isolated environment (virtual machine or throwaway profile) and review the code before use.
功能分析
Type: OpenClaw Skill Name: baoyu-post-to-xhs Version: 1.2.0 The skill bundle is a legitimate automation tool for posting image-text notes to Xiaohongshu (XHS) via Chrome CDP. The core logic in `xhs-browser.ts` and the supporting library in `scripts/vendor/baoyu-chrome-cdp/` focus on browser manipulation, such as navigating to the creator platform, handling logins, uploading images, and filling form fields. While the scripts use system commands like `ps aux` and `pkill` to manage Chrome instances and access local configuration files (e.g., `EXTEND.md`), these actions are well-documented and strictly aligned with the stated purpose of bypassing anti-bot detection for social media automation. No evidence of data exfiltration, unauthorized credential access, or malicious persistence was found.
能力评估
Purpose & Capability
Name/description match the actual behavior: the scripts launch or attach to a local Chrome/Chromium instance via the Chrome DevTools Protocol (CDP), discover/inspect the publish page, upload images, fill title/content/topics, and optionally auto-submit. Requiring a local browser and a JS runtime (bun or npx -> bun) is appropriate for this purpose.
Instruction Scope
SKILL.md directs the agent to run TypeScript scripts in scripts/ using bun/npx. The scripts legitimately probe the page DOM, search for file inputs, buttons, and visible text, and dump HTML snippets to the console to locate upload elements. This is broader than simply 'click upload' (it collects page text and HTML snippets), but that behavior is coherent with fragile web automation tasks. Users should be aware the scripts will read the page DOM and log portions of the page (visible text, upload-area HTML, form element info).
Install Mechanism
No network install spec is included (instruction-only + bundled TS sources). The package includes a small local vendor library. The check script suggests running npm install in scripts/ if dependencies are missing; that is a normal, traceable action (no remote arbitrary downloads or URL-extract installs are present in the provided files).
Credentials
The skill requests no external API keys or secrets. It does interact with Chrome user-data/profile directories and will create/use a dedicated profile under a baoyu-skills path by default. Because it attaches to a browser (and may reuse an existing debug-enabled Chrome process if directed), it can access whatever is available in that browser profile (sessions/cookies). This access is necessary to post as the user, but you should avoid pointing it at your primary Chrome profile or leaving a logged-in shared profile exposed.
Persistence & Privilege
always is false and the skill does not request agent-wide persistence. It may create a profile directory for Chrome automation and can leave a Chrome process running (scripts call chrome.unref()). It does not modify other skills or system-wide agent configs.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install baoyu-post-to-xhs
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /baoyu-post-to-xhs 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.2.0
baoyu-post-to-xhs 1.2.0 - Updated documentation in SKILL.md; no workflow or parameter changes. - No functional changes to scripts or interfaces.
v1.1.0
Fix: SPA rendering wait - replace fixed sleep with polling for page readiness; fixes tab/upload/form not found on slow connections
v1.0.0
Initial release of baoyu-post-to-xhs: post image-text notes to Xiaohongshu (小红书) via a real Chrome browser. - Supports posting notes with multiple images, titles, descriptions, and topics. - Offers both preview (manual submit) and fully automated publishing with `--submit`. - Matches response language to user's input. - Allows flexible image input (single files or folders), content via title/content or Markdown. - Stores Chrome profile for session persistence; manual login required on first run. - EXTEND.md support for config overrides (e.g., Chrome profile path); checks user/project/global locations. - Robust troubleshooting, pre-flight environment checks, and cross-platform support (macOS, Linux, Windows).
元数据
Slug baoyu-post-to-xhs
版本 1.2.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 3
常见问题

Baoyu Post To Xhs 是什么?

Posts image-text notes to Xiaohongshu (小红书) via Chrome CDP. Supports uploading multiple images, filling title/description, adding topics, and optional auto-s... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 278 次。

如何安装 Baoyu Post To Xhs?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install baoyu-post-to-xhs」即可一键安装,无需额外配置。

Baoyu Post To Xhs 是免费的吗?

是的,Baoyu Post To Xhs 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Baoyu Post To Xhs 支持哪些平台?

Baoyu Post To Xhs 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Baoyu Post To Xhs?

由 praguepp(@praguepp)开发并维护,当前版本 v1.2.0。

💬 留言讨论