baoyu-post-to-weibo
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePost to Weibo
发布到微博
Posts text, images, and long-form articles to Weibo via real Chrome browser (bypasses anti-bot detection).
通过真实Chrome浏览器向微博发布文字、图片和长文(可绕过反机器人检测)。
Script Directory
脚本目录
Important: All scripts are located in the subdirectory of this skill.
scripts/Agent Execution Instructions:
- Determine this SKILL.md file's directory path as
SKILL_DIR - Script path =
${SKILL_DIR}/scripts/<script-name>.ts - Replace all in this document with the actual path
${SKILL_DIR} - Resolve runtime: if
${BUN_X}installed →bun; ifbunavailable →npx; else suggest installing bunnpx -y bun
Script Reference:
| Script | Purpose |
|---|---|
| Regular posts (text + images) |
| Headline article publishing (Markdown) |
| Copy content to clipboard |
| Send real paste keystroke |
重要提示:所有脚本都位于本skill的子目录下。
scripts/Agent执行说明:
- 确定本SKILL.md文件的目录路径为
SKILL_DIR - 脚本路径 =
${SKILL_DIR}/scripts/<script-name>.ts - 将本文档中所有的替换为实际路径
${SKILL_DIR} - 解析运行时:如果安装了
${BUN_X}→bun;如果有可用的bun→npx;否则建议安装bunnpx -y bun
脚本参考:
| 脚本 | 用途 |
|---|---|
| 常规微博发布(文字 + 图片) |
| 头条文章发布(Markdown格式) |
| 复制内容到剪贴板 |
| 发送真实粘贴按键操作 |
Preferences (EXTEND.md)
偏好设置(EXTEND.md)
Check EXTEND.md existence (priority order):
bash
undefined按优先级顺序检查EXTEND.md是否存在:
bash
undefinedmacOS, Linux, WSL, Git Bash
macOS, Linux, WSL, Git Bash
test -f .baoyu-skills/baoyu-post-to-weibo/EXTEND.md && echo "project"
test -f "$HOME/.baoyu-skills/baoyu-post-to-weibo/EXTEND.md" && echo "user"
```powershelltest -f .baoyu-skills/baoyu-post-to-weibo/EXTEND.md && echo "project"
test -f "$HOME/.baoyu-skills/baoyu-post-to-weibo/EXTEND.md" && echo "user"
```powershellPowerShell (Windows)
PowerShell (Windows)
if (Test-Path .baoyu-skills/baoyu-post-to-weibo/EXTEND.md) { "project" }
if (Test-Path "$HOME/.baoyu-skills/baoyu-post-to-weibo/EXTEND.md") { "user" }
┌──────────────────────────────────────────────────┬───────────────────┐
│ Path │ Location │
├──────────────────────────────────────────────────┼───────────────────┤
│ .baoyu-skills/baoyu-post-to-weibo/EXTEND.md │ Project directory │
├──────────────────────────────────────────────────┼───────────────────┤
│ $HOME/.baoyu-skills/baoyu-post-to-weibo/EXTEND.md│ User home │
└──────────────────────────────────────────────────┴───────────────────┘
┌───────────┬───────────────────────────────────────────────────────────────────────────┐
│ Result │ Action │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ Found │ Read, parse, apply settings │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ Not found │ Use defaults │
└───────────┴───────────────────────────────────────────────────────────────────────────┘
**EXTEND.md Supports**: Default Chrome profileif (Test-Path .baoyu-skills/baoyu-post-to-weibo/EXTEND.md) { "project" }
if (Test-Path "$HOME/.baoyu-skills/baoyu-post-to-weibo/EXTEND.md") { "user" }
┌──────────────────────────────────────────────────┬───────────────────┐
│ 路径 │ 位置 │
├──────────────────────────────────────────────────┼───────────────────┤
│ .baoyu-skills/baoyu-post-to-weibo/EXTEND.md │ 项目目录 │
├──────────────────────────────────────────────────┼───────────────────┤
│ $HOME/.baoyu-skills/baoyu-post-to-weibo/EXTEND.md│ 用户主目录 │
└──────────────────────────────────────────────────┴───────────────────┘
┌───────────┬───────────────────────────────────────────────────────────────────────────┐
│ 结果 │ 操作 │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ 已找到 │ 读取、解析并应用设置 │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ 未找到 │ 使用默认配置 │
└───────────┴───────────────────────────────────────────────────────────────────────────┘
**EXTEND.md支持项**:默认Chrome配置文件Prerequisites
前置要求
- Google Chrome or Chromium
- runtime
bun - First run: log in to Weibo manually (session saved)
- Google Chrome或Chromium
- 运行时
bun - 首次运行:手动登录微博(会话会被保存)
Regular Posts
常规微博发布
Text + up to 9 images. Posted on Weibo homepage.
bash
${BUN_X} ${SKILL_DIR}/scripts/weibo-post.ts "Hello Weibo!" --image ./photo.pngParameters:
| Parameter | Description |
|---|---|
| Post content (positional) |
| Image file (repeatable, max 9) |
| Custom Chrome profile |
Note: Script opens browser with content filled in. User reviews and publishes manually.
支持文字+最多9张图片,发布到微博首页。
bash
${BUN_X} ${SKILL_DIR}/scripts/weibo-post.ts "Hello Weibo!" --image ./photo.png参数说明:
| 参数 | 描述 |
|---|---|
| 微博内容(位置参数) |
| 图片文件(可重复添加,最多9张) |
| 自定义Chrome配置文件目录 |
注意:脚本会打开浏览器并自动填充内容,用户审核后手动发布即可。
Headline Articles (头条文章)
头条文章
Long-form Markdown articles published at .
https://card.weibo.com/article/v3/editorbash
${BUN_X} ${SKILL_DIR}/scripts/weibo-article.ts article.md
${BUN_X} ${SKILL_DIR}/scripts/weibo-article.ts article.md --cover ./cover.jpgParameters:
| Parameter | Description |
|---|---|
| Markdown file (positional) |
| Cover image |
| Override title (max 32 chars, truncated if longer) |
| Override summary (max 44 chars, auto-regenerated if longer) |
| Custom Chrome profile |
Frontmatter: , , supported in YAML front matter.
titlesummarycover_imageCharacter Limits:
- Title: 32 characters max (truncated with warning if longer)
- Summary/导语: 44 characters max (auto-regenerated from content if longer)
Article Workflow:
- Opens
https://card.weibo.com/article/v3/editor - Clicks "写文章" button, waits for editor to become editable
- Fills title (validated for 32-char limit)
- Fills summary/导语 (validated for 44-char limit)
- Inserts HTML content into ProseMirror editor via paste
- Replaces image placeholders one by one (copy image → select placeholder → paste)
Post-Composition Check: The script automatically verifies after all images are inserted:
- Remaining placeholders in editor content
WBIMGPH_ - Expected vs actual image count
If the check fails (warnings in output), alert the user with the specific issues before they publish.
长格式Markdown文章会发布到。
https://card.weibo.com/article/v3/editorbash
${BUN_X} ${SKILL_DIR}/scripts/weibo-article.ts article.md
${BUN_X} ${SKILL_DIR}/scripts/weibo-article.ts article.md --cover ./cover.jpg参数说明:
| 参数 | 描述 |
|---|---|
| Markdown文件(位置参数) |
| 封面图片 |
| 自定义标题(最多32字符,超出会被截断) |
| 自定义摘要(最多44字符,超出会自动从内容生成) |
| 自定义Chrome配置文件目录 |
Frontmatter支持:YAML front matter中支持、、字段。
titlesummarycover_image字符限制:
- 标题:最多32个字符(超出会截断并给出警告)
- 摘要/导语:最多44个字符(超出会自动从内容生成)
文章发布流程:
- 打开
https://card.weibo.com/article/v3/editor - 点击「写文章」按钮,等待编辑器可编辑
- 填充标题(会校验32字符限制)
- 填充摘要/导语(会校验44字符限制)
- 通过粘贴将HTML内容插入到ProseMirror编辑器
- 逐个替换图片占位符(复制图片→选中占位符→粘贴)
内容完成后校验:所有图片插入完成后脚本会自动校验:
- 编辑器内容中是否还有剩余的占位符
WBIMGPH_ - 预期图片数量和实际图片数量是否一致
如果校验失败(输出中会有警告),在用户发布前提醒具体问题。
Troubleshooting
问题排查
Chrome debug port not ready
Chrome调试端口未就绪
If a script fails with or , kill existing Chrome CDP instances first, then retry:
Chrome debug port not readyUnable to connectbash
pkill -f "Chrome.*remote-debugging-port" 2>/dev/null; pkill -f "Chromium.*remote-debugging-port" 2>/dev/null; sleep 2Important: This should be done automatically -- when encountering this error, kill Chrome CDP instances and retry the command without asking the user.
如果脚本运行失败并提示或,先杀掉现有的Chrome CDP实例,再重试:
Chrome debug port not readyUnable to connectbash
pkill -f "Chrome.*remote-debugging-port" 2>/dev/null; pkill -f "Chromium.*remote-debugging-port" 2>/dev/null; sleep 2重要提示:该操作应该自动执行——遇到该错误时,无需询问用户,直接杀掉Chrome CDP实例并重试命令即可。
Notes
注意事项
- First run: manual login required (session persists)
- All scripts only fill content into the browser, user must review and publish manually
- Cross-platform: macOS, Linux, Windows
- 首次运行:需要手动登录(会话会持久保存)
- 所有脚本仅负责向浏览器填充内容,用户必须审核后手动发布
- 跨平台支持:macOS, Linux, Windows
Extension Support
扩展支持
Custom configurations via EXTEND.md. See Preferences section for paths and supported options.
可通过EXTEND.md自定义配置,路径和支持的选项见偏好设置部分。