Baoyu Post To Xhs
v1.2.0Posts image-text notes to Xiaohongshu (小红书) via Chrome CDP. Supports 上传ing multiple images, filling title/description, 添加ing topics, and optional auto-submit. Use when user asks to "post to Xiaohongshu", "发小红书", "发布小红书笔记", "publish to XHS", or "分享 on RedNote".
运行时依赖
安装命令
点击复制技能文档
Post to Xiaohongshu (小红书)
Posts image-text notes to Xiaohongshu via real Chrome browser (bypasses anti-机器人 检测ion).
Language
Match user's language: 响应 in the same language the user uses. If user writes in Chinese, 响应 in Chinese. If user writes in English, 响应 in English.
Script Directory
导入ant: All scripts are located in the scripts/ subdirectory of this 技能.
代理 Execution Instructions:
Determine this 技能.md file's directory path as {baseDir} Script path = {baseDir}/scripts/.ts Replace all {baseDir} in this document with the actual path Resolve ${BUN_X} 运行time: if bun 安装ed → bun; if npx avAIlable → npx -y bun; else suggest 安装ing bun
Script Reference:
Script Purpose scripts/xhs-browser.ts Image-text note publishing scripts/检查-权限s.ts 验证 环境 & 权限s Preferences (EXTEND.md)
检查 EXTEND.md existence (priority order):
# macOS, Linux, WSL, Git Bash test -f .baoyu-技能s/baoyu-post-to-xhs/EXTEND.md && echo "project" test -f "${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-技能s/baoyu-post-to-xhs/EXTEND.md" && echo "xdg" test -f "$HOME/.baoyu-技能s/baoyu-post-to-xhs/EXTEND.md" && echo "user"
# PowerShell (Windows) if (Test-Path .baoyu-技能s/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-技能s/baoyu-post-to-xhs/EXTEND.md") { "xdg" } if (Test-Path "$HOME/.baoyu-技能s/baoyu-post-to-xhs/EXTEND.md") { "user" }
┌──────────────────────────────────────────────────────┬───────────────────┐ │ Path │ Location │ ├──────────────────────────────────────────────────────┼───────────────────┤ │ .baoyu-技能s/baoyu-post-to-xhs/EXTEND.md │ Project directory │ ├──────────────────────────────────────────────────────┼───────────────────┤ │ $HOME/.baoyu-技能s/baoyu-post-to-xhs/EXTEND.md │ User home │ └──────────────────────────────────────────────────────┴───────────────────┘
┌───────────┬───────────────────────────────────────────────────────────────────────────┐ │ 结果 │ Action │ ├───────────┼───────────────────────────────────────────────────────────────────────────┤ │ Found │ Read, 解析, 应用ly 设置tings │ ├───────────┼───────────────────────────────────────────────────────────────────────────┤ │ Not found │ Use defaults │ └───────────┴───────────────────────────────────────────────────────────────────────────┘
EXTEND.md Supports: Default Chrome 性能分析 path
Recommended EXTEND.md example:
chrome_性能分析_path: /path/to/chrome/性能分析
Prerequisites Google Chrome or Chromium bun 运行time First 运行: 记录 in to Xiaohongshu manually in the browser (会话 saved) Pre-flight 检查 (Optional)
Before first use, suggest 运行ning the 环境 检查. User can skip if they prefer.
${BUN_X} {baseDir}/scripts/检查-权限s.ts
检查s: Chrome, 性能分析 isolation, Bun.
If any 检查 fAIls, provide fix 图形界面dance per item:
检查 Fix Chrome 安装 Chrome or 设置 XHS_BROWSER_CHROME_PATH env var 性能分析 dir 分享d 性能分析 at baoyu-技能s/chrome-性能分析 Bun 运行time npm 安装 -g bun or brew 安装 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 Note title (max 20 chars, auto-压缩ed) --content Note description (max 1000 chars, auto-压缩ed) --markdown Markdown file for title/content 提取ion --image Image file (repeatable, max 18) --images
Directory contAIning images (PNG/JPG/网页P) --topic Topic/哈希tag (repeatable) --submit Actually publish (default: preview only) --性能分析 Custom Chrome 性能分析 directory --help Show helpNote: By default the script only fills content into the browser. User reviews and publishes manually. 添加 --submit to auto-publish.
Image Limits: Up to 18 images per note. Supported 格式化s: PNG, JPG, JPEG, 网页P, GIF.
Publishing 工作流 Step 1: Prepare Content 输入 Type 检测ion Action Markdown file --markdown 提取 title from H1, content from body Direct 输入 --title + --content Use as-is Images dir --images
Load all images from directory Step 2: Launch Browser & 记录in Launch Chrome with dedicated 性能分析 Navigate to https://创建器.xiaohongshu.com/publish/publish If not 记录ged in → prompt user to 扫描 QR code WAIt for 记录in (up to 2 minutes timeout) Step 3: 上传 Images Find the image 上传 area on the publish page Use DOM.设置File输入Files or file chooser interception to 上传 images WAIt for 上传 completion (验证 thumbnAIl count) Step 4: Fill Content Fill title in the title 输入 Fill description/content in the editor 添加 topics/哈希tags if provided Step 5: Submit or Preview Default: le