baoyu-post-to-weibo
- 作者仓库星标 0
- 作者更新于 2026年7月4日 09:22
- 作者仓库 baoyu-skills
发布到微博
通过真实的 Chrome 浏览器发布文本、图片、视频和长篇文章到微博(绕过反机器人检测)。
脚本目录
重要提示:所有脚本都位于此技能的 scripts/ 子目录中。
Agent 执行说明:
- 确定此 SKILL.md 文件的目录路径为
{baseDir} - 脚本路径 =
{baseDir}/scripts/<script-name>.ts - 将本文档中的所有
{baseDir}替换为实际路径 - 解析
${BUN_X}运行时:如果安装了bun→bun;如果npx可用 →npx -y bun;否则建议安装 bun
脚本参考:
| 脚本 | 用途 |
|---|---|
scripts/weibo-post.ts |
常规帖子(文本 + 图片) |
scripts/weibo-article.ts |
头条文章发布(Markdown) |
scripts/copy-to-clipboard.ts |
复制内容到剪贴板 |
scripts/paste-from-clipboard.ts |
发送真实的粘贴按键 |
首选项 (EXTEND.md)
按优先级顺序检查 EXTEND.md — 找到的第一个生效:
| 优先级 | 路径 | 范围 |
|---|---|---|
| 1 | .baoyu-skills/baoyu-post-to-weibo/EXTEND.md |
项目 |
| 2 | ${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-post-to-weibo/EXTEND.md |
XDG |
| 3 | $HOME/.baoyu-skills/baoyu-post-to-weibo/EXTEND.md |
用户主目录 |
如果未找到,则使用默认值。
EXTEND.md 支持:默认 Chrome 配置文件
先决条件
- Google Chrome 或 Chromium
bun运行时- 首次运行:手动登录微博(会话已保存)
常规帖子
文本 + 图片/视频(总计最多 18 个文件)。发布到微博主页。
${BUN_X} {baseDir}/scripts/weibo-post.ts "Hello Weibo!" --image ./photo.png
${BUN_X} {baseDir}/scripts/weibo-post.ts "Watch this" --video ./clip.mp4
参数:
| 参数 | 描述 |
|---|---|
<text> |
帖子内容(位置参数) |
--image <path> |
图片文件(可重复) |
--video <path> |
视频文件(可重复) |
--profile <dir> |
自定义 Chrome 配置文件 |
注意:脚本会打开浏览器并填充内容。用户需手动审核并发布。
头条文章
长篇 Markdown 文章发布到 https://card.weibo.com/article/v3/editor。
${BUN_X} {baseDir}/scripts/weibo-article.ts article.md
${BUN_X} {baseDir}/scripts/weibo-article.ts article.md --cover ./cover.jpg
参数:
| 参数 | 描述 |
|---|---|
<markdown> |
Markdown 文件(位置参数) |
--cover <path> |
封面图片 |
--title <text> |
覆盖标题(最多 32 个字符,如果更长则截断) |
--summary <text> |
覆盖摘要(最多 44 个字符,如果更长则自动重新生成) |
--profile <dir> |
自定义 Chrome 配置文件 |
Frontmatter:YAML front matter 中支持 title、summary、cover_image。
字符限制:
- 标题:最多 32 个字符(如果更长则截断并发出警告)
- 摘要/导语:最多 44 个字符(如果更长则从内容中自动重新生成)
Markdown 转 HTML:将 Markdown 转换为 HTML 时,请勿传递任何 --theme 参数。使用默认主题(无主题参数)。
文章工作流程:
- 打开
https://card.weibo.com/article/v3/editor - 点击「写文章」按钮,等待编辑器变为可编辑状态
- 填写标题(验证 32 字符限制)
- 填写摘要/导语(验证 44 字符限制)
- 通过粘贴将 HTML 内容插入到 ProseMirror 编辑器中
- 逐一替换图片占位符(复制图片 → 选择占位符 → 粘贴)
撰写后检查:脚本会在所有图片插入后自动验证:
- 编辑器内容中剩余的
WBIMGPH_占位符 - 预期与实际的图片数量
如果检查失败(输出中出现警告),在用户发布前向其提示具体问题。
帖子类型选择
除非用户明确指定帖子类型:
- Markdown 文件 (
.md) → 头条文章 - 纯文本 / 带图片的文本 → 常规帖子
故障排除
Chrome 调试端口未就绪
如果脚本因 Chrome debug port not ready 或 Unable to connect 而失败,请仅终止 CDP Chrome 实例(那些带有 --remote-debugging-port 和 baoyu-skills 配置文件的实例),然后重试:
pkill -f "remote-debugging-port.*baoyu-skills/chrome-profile" 2>/dev/null; sleep 2
关键:切勿终止所有 Chrome 进程 (pkill -f "Google Chrome")。只终止由 CDP 启动的、使用 baoyu-skills 配置文件目录的 Chrome 实例。用户可能打开了常规 Chrome 窗口。
重要提示:这应该自动完成——当遇到此错误时,终止 CDP Chrome 实例并重试命令,无需询问用户。
注意事项
- 首次运行:需要手动登录(会话会持久化)
- 所有脚本只将内容填充到浏览器中,用户必须手动审核并发布
- 跨平台:macOS、Linux、Windows
扩展支持
通过 EXTEND.md 进行自定义配置。请参阅「首选项」部分了解路径和支持的选项。
Post to Weibo
Posts text, images, videos, and long-form articles to Weibo via real Chrome browser (bypasses anti-bot detection).
Script Directory
Important: All scripts are located in the scripts/ subdirectory of this skill.
Agent Execution Instructions:
- Determine this SKILL.md file's directory path as
{baseDir} - Script path =
{baseDir}/scripts/<script-name>.ts - Replace all
{baseDir}in this document with the actual path - Resolve
${BUN_X}runtime: ifbuninstalled →bun; ifnpxavailable →npx -y bun; else suggest installing bun
Script Reference:
| Script | Purpose |
|---|---|
scripts/weibo-post.ts |
Regular posts (text + images) |
scripts/weibo-article.ts |
Headline article publishing (Markdown) |
scripts/copy-to-clipboard.ts |
Copy content to clipboard |
scripts/paste-from-clipboard.ts |
Send real paste keystroke |
Preferences (EXTEND.md)
Check EXTEND.md in priority order — the first one found wins:
| Priority | Path | Scope |
|---|---|---|
| 1 | .baoyu-skills/baoyu-post-to-weibo/EXTEND.md |
Project |
| 2 | ${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-post-to-weibo/EXTEND.md |
XDG |
| 3 | $HOME/.baoyu-skills/baoyu-post-to-weibo/EXTEND.md |
User home |
If none found, use defaults.
EXTEND.md supports: Default Chrome profile
Prerequisites
- Google Chrome or Chromium
bunruntime- First run: log in to Weibo manually (session saved)
Regular Posts
Text + images/videos (max 18 files total). Posted on Weibo homepage.
${BUN_X} {baseDir}/scripts/weibo-post.ts "Hello Weibo!" --image ./photo.png
${BUN_X} {baseDir}/scripts/weibo-post.ts "Watch this" --video ./clip.mp4
Parameters:
| Parameter | Description |
|---|---|
<text> |
Post content (positional) |
--image <path> |
Image file (repeatable) |
--video <path> |
Video file (repeatable) |
--profile <dir> |
Custom Chrome profile |
Note: Script opens browser with content filled in. User reviews and publishes manually.
Headline Articles (头条文章)
Long-form Markdown articles published at https://card.weibo.com/article/v3/editor.
${BUN_X} {baseDir}/scripts/weibo-article.ts article.md
${BUN_X} {baseDir}/scripts/weibo-article.ts article.md --cover ./cover.jpg
Parameters:
| Parameter | Description |
|---|---|
<markdown> |
Markdown file (positional) |
--cover <path> |
Cover image |
--title <text> |
Override title (max 32 chars, truncated if longer) |
--summary <text> |
Override summary (max 44 chars, auto-regenerated if longer) |
--profile <dir> |
Custom Chrome profile |
Frontmatter: title, summary, cover_image supported in YAML front matter.
Character Limits:
- Title: 32 characters max (truncated with warning if longer)
- Summary/导语: 44 characters max (auto-regenerated from content if longer)
Markdown-to-HTML: Do NOT pass any --theme parameter when converting markdown to HTML. Use the default theme (no theme argument).
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
WBIMGPH_placeholders in editor content - Expected vs actual image count
If the check fails (warnings in output), alert the user with the specific issues before they publish.
Post Type Selection
Unless the user explicitly specifies the post type:
- Markdown file (
.md) → Headline Article (头条文章) - Plain text / text with images → Regular Post
Troubleshooting
Chrome debug port not ready
If a script fails with Chrome debug port not ready or Unable to connect, kill only the CDP Chrome instances (those with --remote-debugging-port AND the baoyu-skills profile), then retry:
pkill -f "remote-debugging-port.*baoyu-skills/chrome-profile" 2>/dev/null; sleep 2
CRITICAL: Never kill all Chrome processes (pkill -f "Google Chrome"). Only kill Chrome instances launched by CDP with the baoyu-skills profile directory. The user may have regular Chrome windows open.
Important: This should be done automatically -- when encountering this error, kill the CDP Chrome instances and retry the command without asking the user.
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
Extension Support
Custom configurations via EXTEND.md. See Preferences section for paths and supported options.
- 流狐分类
- 文档
- 作者声明 Agent
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 92 / 100 · 启发式扫描,不代表运行安全
- 作者 / 版本 / 许可
- @JimLiu · v1.117.3 · 未声明 license
- 流狐 Token 估算
- 低消耗
- 流狐接入估算
- 需简单配置
- 是否需要外部 API Key
- 未发现要求
- 检测到的系统要求
- macOS · Linux · Windows
- 底层运行要求
- Bun
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 检测到的网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
作者没有在当前 SKILL.md 中定义固定输出样例。 Important: All scripts are located in the scripts/ subdirectory of this skill. Agent Execution Instructions: Determine this SKILL.md file's directory path as {baseDir}
Check EXTEND.md in priority order — the first one found wins: Priority · Path · Scope 1 · .baoyu-skills/baoyu-post-to-weibo/EXTEND.md · Project
Google Chrome or Chromium bun runtime First run: log in to Weibo manually (session saved)
Text + images/videos (max 18 files total). Posted on Weibo homepage. Parameters: Parameter · Description
Long-form Markdown articles published at https://card.weibo.com/article/v3/editor. Parameters: Parameter · Description
Unless the user explicitly specifies the post type: Markdown file (.md) → Headline Article (头条文章) Plain text / text with images → Regular Post
# Post to Weibo
Posts text, images, videos, and long-form articles to Weibo via real Chrome browser (bypasses anti-bot detection).
## 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**:
| Script | Purpose |
|--------|---------|
| `scripts/weibo-post.ts` | Regular posts (text + images) |
| `scripts/weibo-article.ts` | Headline article publishing (Markdown) |
| `scripts/copy-to-clipboard.ts` | Copy content to clipboard |
| `scripts/paste-from-clipboard.ts` | Send real paste keystroke |
## Preferences (EXTEND.md)
Check EXTEND.md in priority order — the first one found wins:
| Priority | Path | Scope |
|----------|------|-------|
| 1 | `.baoyu-skills/baoyu-post-to-weibo/EXTEND.md` | Project |
| 2 | `${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-post-to-weibo/EXTEND.md` | XDG |
| 3 | `$HOME/.baoyu-skills/baoyu-post-to-weibo/EXTEND.md` | User home |
If none found, use defaults.
**EXTEND.md supports**: Default Chrome profile
## Prerequisites
- Google Chrome or Chromium
- `bun` runtime
- First run: log in to Weibo manually (session saved)
---
## Regular Posts
Text + images/videos (max 18 files total). Posted on Weibo homepage.
```bash
${BUN_X} {baseDir}/scripts/weibo-post.ts "Hello Weibo!" --image ./photo.png
${BUN_X} {baseDir}/scripts/weibo-post.ts "Watch this" --video ./clip.mp4
```
**Parameters**:
| Parameter | Description |
… 作者原文负责流程事实;流狐只索引当前章节、要点、文件与命令。
章节 -> Script Directory → Preferences (EXTEND.md) → Prerequisites → Regular Posts → Headline Articles (头条文章) → Post Type Selection
要点 -> Important · Agent Execution Instructions · Script Reference · EXTEND.md supports · Parameters · Note · Frontmatter · Character Limits
文件/命令 -> scripts/ · {baseDir} · {baseDir}/scripts/<script-name>.ts · ${BUNX} · bun · npx · npx -y bun · scripts/weibo-post.ts
内容 SHA-256 -> da0954a8cfcf
原文结构
适用与边界
原文中的明确线索
scripts/、{baseDir}、{baseDir}/scripts/<script-name>.ts、${BUNX}、bun、npx、npx -y bun、scripts/weibo-post.ts