Home / All Skills / Content & Media Creation / baoyu-post-to-weibo
Content & Media Creation · JimLiu/baoyu-skills

baoyu-post-to-weibo

Posts content to Weibo (微博). Supports regular posts with text, images, and videos, and headline articles (头条文章) with Markdown input via Chrome CDP. Use when user asks to "post to Weibo", "发微博", "发布微博", "publish to Weibo", "share on Weibo", "写微博", or "微博头条文章".

L5 Restricted · Isolated sandbox & strict auditV2 Human-AuditedReverse APITerms / ComplianceCredential / SessionExecute CommandExternal WriteNetwork AccessWrite FileDual-pass Audit
Author JimLiuGitHub JimLiu/baoyu-skills ↗Stars 25926License MIT(仓库根 LICENSE,Copyright (c) 2026 Jim Liu;GitHub API spdx_id=MIT)Commit 1567581c26
Control levels describe skill capabilities and suggested control measures; they do not represent quality or safety certifications, nor do they dictate usability. Usage decisions rest entirely with users and administrators. Different agent hosts apply varying constraints; do not assume hosts provide automatic protection. Third-party skill copyrights belong to their original authors. Use at your own risk.

1How It Works & Mechanism

The implementation approach drives a real local Chrome instance: locate the Chrome executable → launch an instance with a debugging port enabled (isolated profile) → wait for the debugging port to be ready → connect via CDP WebSocket → attach to the target page.

skills/baoyu-post-to-weibo/scripts/weibo-utils.ts
export async function launchChrome(url: string, profileDir: string, chromePathOverride?: string): Promise<number> {
No HTTP-level reverse engineering or private API request construction is performed; all operations take place inside real browser pages (which is also the prerequisite for bypassing the platform's anti-bot detection).

Bypassing anti-automation detection is an explicit design choice of this skill: the opening paragraph of SKILL.md highlights it as a selling point, and the code disables Chrome's automation feature flags.

skills/baoyu-post-to-weibo/scripts/weibo-utils.ts
extraArgs: ['--disable-blink-features=AutomationControlled', '--start-maximized'],
Original quote from SKILL.md: `Posts text, images, videos, and long-form articles to Weibo via real Chrome browser (bypasses anti-bot detection).` Technical circumvention of platform automated detection is the primary reason for flagging this skill as red.

The primary method for content injection is 'real keystroke pasting' rather than synthetic events, with the rationale explicitly stated in the script's comments: websites can detect and ignore CDP synthetic events.

skills/baoyu-post-to-weibo/scripts/paste-from-clipboard.ts
This bypasses CDP's synthetic events which websites can detect and ignore.
Call chain: copyHtmlToClipboard/copyImageToClipboard in weibo-utils.ts invokes copy-to-clipboard.ts via `spawnSync('npx', ['-y', 'bun', scriptPath, ...args])`, followed by pasteFromClipboard → paste-from-clipboard.ts sending real Cmd+V/Ctrl+V keystrokes (macOS via osascript System Events, Linux via xdotool/ydotool, Windows via PowerShell SendKeys). In weibo-article.ts: `// Method 1: Copy HTML to system clipboard, then real paste keystroke`, while CDP synthetic events only serve as a fallback.

Text input for regular posts uses CDP Input.insertText with a fallback to execCommand upon failure; media uploads pass file paths directly to the page's file input, verified by counting blob:/data: resources.

skills/baoyu-post-to-weibo/scripts/weibo-post.ts
await cdp.send('Input.insertText', { text }, { sessionId });
Uploads target `#homeWrap input[type="file"]` using `DOM.setFileInputFiles`; the verification expression counts `#homeWrap img[src^="blob:"], #homeWrap img[src^="data:"], #homeWrap video`, capped at 18 files (MAX_FILES = 18).

Headline articles are handled through ProseMirror editor on card.weibo.com: populate title/summary → paste HTML → replace image placeholders one by one via 'copy image + real paste keystroke' → verify remaining placeholders and image counts.

skills/baoyu-post-to-weibo/scripts/weibo-article.ts
// Method 1: Copy HTML to system clipboard, then real paste keystroke
Editor entry constant: `const WEIBO_ARTICLE_URL = 'https://card.weibo.com/article/v3/editor';`. The image replacement loop similarly uses copyImageToClipboard → pasteFromClipboard('Google Chrome', 5, 1000).

Platform character limits are hardcoded and handled automatically: 32 characters for titles, 44 characters for summaries, with overlong text truncated at punctuation boundaries or regenerated from the body.

skills/baoyu-post-to-weibo/scripts/weibo-article.ts
const TITLE_MAX_LENGTH = 32;
In the same file: `const SUMMARY_MAX_LENGTH = 44;`. Overlong summaries are regenerated using parsed.shortSummary or truncated with an ellipsis appended.

Can take over or reuse an already running debugging Chrome: matches processes in the process list by profile directory + --remote-debugging-port, terminating only instances belonging to its own profile when necessary.

skills/baoyu-post-to-weibo/scripts/weibo-utils.ts
if (!line.includes(profileDir) || !line.includes('--remote-debugging-port=')) continue;
killChromeByProfile locates processes with `spawnSync('ps', ['aux'])` and terminates them via `process.kill(Number(pid), 'SIGTERM')`. SKILL.md outlines a CRITICAL discipline for this: `Only kill Chrome instances launched by CDP with the baoyu-skills profile directory.` (prohibiting global pkill on all user Chrome instances).

Login state relies on a persistent Chrome profile, requiring a one-time manual login on the first run for long-term reuse; the script only fills content into the page, leaving publication for the user to confirm manually.

skills/baoyu-post-to-weibo/SKILL.md
All scripts only fill content into the browser, user must review and publish manually
Another mention in SKILL.md states: `First run: log in to Weibo manually (session saved)`—the session resides in cookies/storage within the profile directory, representing a typical 'reuse logged-in browser session' pattern (credential surface source).

2Core Capabilities

01Regular Weibo publishing (text + images/videos, up to 18 files)
02Headline article publishing (Markdown → HTML → ProseMirror editor, supports frontmatter title/summary/cover_image)
03Title and summary length compliance (32/44 characters) with automatic truncation or regeneration when exceeded
04Image placeholder replacement + pre-publish self-check (comparing remaining WBIMGPH_ placeholders against expected image count)
05Cross-platform clipboard and keystroke injection (macOS swift/osascript, Linux wl-copy/xclip + xdotool/ydotool, Windows PowerShell)
06Debugging Chrome instance reuse and profile-specific precision cleanup (prevents terminating user's daily Chrome browser)
07Reusing existing login states (configurable default Chrome profile in EXTEND.md) to avoid repeated QR code scanning

3External Dependencies

KindDependency / Endpoint
network浏览器访问 weibo.com 与 card.weibo.com(发帖与头条文章编辑器)
network头条文章编辑器入口
cli本地 Chrome/Chromium(--remote-debugging-port + --user-data-dir,带 AutomationControlled 关闭参数)
cli粘贴按键注入工具(macOS osascript / Linux xdotool 或 ydotool / Windows powershell.exe)
cli剪贴板工具(macOS swift 临时脚本 / Linux wl-copy 或 xclip / Windows PowerShell)
clips(进程枚举,用于复用/清理调试 Chrome)
packagebaoyu-chrome-cdp(npm,仓库 packages/ 内共享包:CDP 连接、Chrome 查找与启动、按键/剪贴板基础件)
packagebaoyu-md(npm,仓库 packages/ 内共享包:Markdown → HTML,供头条文章使用)
clibun(内部以 npx -y bun 调起同目录辅助脚本)

4Recommended Governance & Evidence

Suggested Controls for Safe Operation
For Agent Runtime
Isolated environment, per-use explicit authorization
For Administrators
Strict authorization, full audit, compliance signoff
Evidence & Triggers (File Paths & Excerpts)
  • SKILL.md / 脚本: Calling undocumented or reverse-engineered private APIs / spoofing client identifiers
  • SKILL.md / 脚本参数: Involves bypassing automation detection, disabling host sandbox, or skipping SSL certificate validation
  • SKILL.md / 会话存储: Reading or reusing browser user login state and session cookies
  • scripts/: Executing local scripts or commands: bun {baseDir}/scripts/weibo-post.ts <text> --image/--video …
  • 外部 API: Publishing posts, creating, or modifying resources on external platforms
  • 本地工作目录: File read/write and artifact output: Chrome profile directory (default baoyu-skills/chrome-profile hierarchy, persisting login session and browser data)
Audit Notes: Flagged as Red at the 'capability/policy' level, with boundaries defined within the skill's directory and documented by itself: ① [Technical Anti-Automation Detection Bypass] The opening paragraph of SKILL.md states `Posts text, images, videos, and long-form articles to Weibo via real Chrome browser (bypasses anti-bot detection).`; at the implementation layer, scripts/weibo-utils.ts passes `extraArgs: ['--disable-blink-features=AutomationControlled', '--start-maximized']` to Chrome (disabling automation indicators, the same method leading to notebooklm-skill being flagged red); scripts/paste-from-clipboard.ts notes `This bypasses CDP's synthetic events which websites can detect and ignore.`, and weibo-article.ts uses it as the primary method (`// Method 1: Copy HTML to system clipboard, then real paste keystroke`), retaining CDP synthetic events merely as a fallback. ② [Credential/Session Surface] Reuses persistent Weibo login sessions from the Chrome profile (saved after an initial manual login) and can take over already running debugging Chrome instances; does not read local credential/secret files. ③ [External Side Effects] Publishes posts/headline articles on a public platform under your account (the script only fills in content; publication requires user confirmation); also terminates its own debugging Chrome instances with targeted SIGTERM based on profile matching. Conclusion: No TLS downgrading, no sandbox disabling (Chrome does not use --no-sandbox), no private API reverse engineering, and no client impersonation; the red flag arises solely from the technical circumvention of anti-automation detection.

5Second-Pass Verification

  • [ok] 反自动化检测绕过(判红主因) — 三处证据互相印证:SKILL.md 'bypasses anti-bot detection';weibo-utils.ts `extraArgs: ['--disable-blink-features=AutomationControlled', '--start-maximized'],`(launchChrome 传给 launchChromeBase);paste-from-clipboard.ts 'This bypasses CDP's synthetic events which websites can detect and ignore.'
  • [ok] 真实按键是第一手段而非兜底 — weibo-article.ts 注释排序为 '// Method 1: Copy HTML to system clipboard, then real paste keystroke',失败后才走 DataTransfer paste 事件;图片替换循环直接 pasteFromClipboard('Google Chrome', 5, 1000)。
  • [ok] 凭证面确认(无密钥读取,靠 profile 会话) — 全目录 process.env/API_KEY/TOKEN/SECRET/.env 扫描零命中;SKILL.md 说明登录态由 Chrome profile 持久化(First run: log in to Weibo manually (session saved)),EXTEND.md 仅支持默认 profile 一项。
  • [ok] 外部端点仅微博自家域名 — grep https:// 命中 WEIBO_HOME_URL=https://weibo.com/ 与 WEIBO_ARTICLE_URL=https://card.weibo.com/article/v3/editor,另有一处仅作日志措辞的 'src: https://...';无第三方 API/CDN。
  • [ok] 平台限制与自检 — MAX_FILES=18、TITLE_MAX_LENGTH=32、SUMMARY_MAX_LENGTH=44 均在源码;SKILL.md 的 Post-Composition Check(剩余 WBIMGPH_ 占位符、预期 vs 实际图片数)与代码校验逻辑一致。
  • [ok] 进程清理不会误杀用户浏览器 — killChromeByProfile 只对同时包含 profileDir 与 '--remote-debugging-port=' 的行取 pid 并 SIGTERM;SKILL.md 用 CRITICAL 明确禁止 `pkill -f "Google Chrome"`。
  • [ok] 无其他安全降级 — grep no-sandbox / rejectUnauthorized / --insecure / NODE_TLS_REJECT / disable-web-security 零命中;Chrome 参数仅为调试端口、profile、AutomationControlled 与最大化窗口。
  • [ok] 元数据(license/stars/commit) — git HEAD=1567581c26ec29f4216c6e6835415bf30343b0e3;仓库根 LICENSE=MIT(Copyright (c) 2026 Jim Liu);GitHub API stars=25926、pushed_at=2026-09-10T15:13:43Z。

6Verdict & Scenarios

  • Uses a real browser to handle Weibo's strict authentication and intensive front-end validation scenarios, avoiding account suspension and maintenance risks associated with custom API clients (at the cost of requiring local Chrome execution).
  • Multi-layered content injection fallbacks + self-checks: insertText/execCommand, native clipboard keystrokes, and DataTransfer events; cross-verifies placeholders and image counts before publishing.
  • Integrates platform constraints directly into the workflow: 18 attachments, 32-character title, 44-character summary, with automatic truncation/regeneration so users don't encounter errors unexpectedly.
  • Clear operational safety boundaries: only populates content without clicking publish (leaving final review to the user); cleans up processes strictly via profile matching and bans global pkill.
  • Cross-platform support across three major OSs: clipboard and keystrokes are independently implemented for macOS, Linux, and Windows, complete with troubleshooting guides for unhealthy Chrome debugging ports.
  • Best for: Ideal for authors who have a Weibo account and want to insert written Markdown into the headline article editor (including cover and inline images) with one click, or for everyday posting scenarios where official/private APIs are unsuitable due to platform restrictions; also suitable as the final step in an automated content production pipeline (provided that anti-bot circumvention methods and account risks are accepted).
    Not for: Not suitable for non-compliant scenarios or users unwilling to accept platform risk control penalties (this skill explicitly includes anti-automation bypass, flagging it as red); not suitable for headless or server environments lacking a GUI or Chrome; not suitable for fully unattended automated publishing pipelines (the script only populates content and requires the user to click publish); not suitable for batch account farming or spam marketing campaigns.
    Install Agent-Ready
    ① Verified Mirror 2026-09-15
    Option A · Direct DownloadDownload baoyu-post-to-weibo.tar.gz
    sha256: 5673e558aeace4cc…
    Option B · Copy Guide for Agent
    install.json
    Agents automatically download and verify mirrors from this JSON guide.
    ② Upstream GitHub
    GitHub Repo ↗
    Pinned to commit 1567581c26.