{"id":"baoyu-post-to-weibo","name":"baoyu-post-to-weibo","summary":"微博にコンテンツを投稿。テキスト、画像、動画を含む通常の投稿と、Chrome CDPでMarkdown入力によるヘッドライン記事(头条文章)をサポートします。","body":"# Post to Weibo\n\nPosts text, images, videos, and long-form articles to Weibo via real Chrome browser (bypasses anti-bot detection).\n\n## Script Directory\n\n**Important**: All scripts are located in the `scripts/` subdirectory of this skill.\n\n**Agent Execution Instructions**:\n1. Determine this SKILL.md file's directory path as `{baseDir}`\n2. Script path = `{baseDir}/scripts/<script-name>.ts`\n3. Replace all `{baseDir}` in this document with the actual path\n4. Resolve `${BUN_X}` runtime: if `bun` installed → `bun`; if `npx` available → `npx -y bun`; else suggest installing bun\n\n**Script Reference**:\n| Script | Purpose |\n|--------|---------|\n| `scripts/weibo-post.ts` | Regular posts (text + images) |\n| `scripts/weibo-article.ts` | Headline article publishing (Markdown) |\n| `scripts/copy-to-clipboard.ts` | Copy content to clipboard |\n| `scripts/paste-from-clipboard.ts` | Send real paste keystroke |\n\n## Preferences (EXTEND.md)\n\nCheck EXTEND.md in priority order — the first one found wins:\n\n| Priority | Path | Scope |\n|----------|------|-------|\n| 1 | `.baoyu-skills/baoyu-post-to-weibo/EXTEND.md` | Project |\n| 2 | `${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-post-to-weibo/EXTEND.md` | XDG |\n| 3 | `$HOME/.baoyu-skills/baoyu-post-to-weibo/EXTEND.md` | User home |\n\nIf none found, use defaults.\n\n**EXTEND.md supports**: Default Chrome profile\n\n## Prerequisites\n\n- Google Chrome or Chromium\n- `bun` runtime\n- First run: log in to Weibo manually (session saved)\n\n---\n\n## Regular Posts\n\nText + images/videos (max 18 files total). Posted on Weibo homepage.\n\n```bash\n${BUN_X} {baseDir}/scripts/weibo-post.ts \"Hello Weibo!\" --image ./photo.png\n${BUN_X} {baseDir}/scripts/weibo-post.ts \"Watch this\" --video ./clip.mp4\n```\n\n**Parameters**:\n| Parameter | Description |\n|-----------|-------------|\n| `<text>` | Post content (positional) |\n| `--image <path>` | Image file (repeatable) |\n| `--video <path>` | Video file (repeatable) |\n| `--profile <dir>` | Custom Chrome profile |\n\n**Note**: Script opens browser with content filled in. User reviews and publishes manually.\n\n---\n\n## Headline Articles (头条文章)\n\nLong-form Markdown articles published at `https://card.weibo.com/article/v3/editor`.\n\n```bash\n${BUN_X} {baseDir}/scripts/weibo-article.ts article.md\n${BUN_X} {baseDir}/scripts/weibo-article.ts article.md --cover ./cover.jpg\n```\n\n**Parameters**:\n| Parameter | Description |\n|-----------|-------------|\n| `<markdown>` | Markdown file (positional) |\n| `--cover <path>` | Cover image |\n| `--title <text>` | Override title (max 32 chars, truncated if longer) |\n| `--summary <text>` | Override summary (max 44 chars, auto-regenerated if longer) |\n| `--profile <dir>` | Custom Chrome profile |\n\n**Frontmatter**: `title`, `summary`, `cover_image` supported in YAML front matter.\n\n**Character Limits**:\n- Title: 32 characters max (truncated with warning if longer)\n- Summary/导语: 44 characters max (auto-regenerated from content if longer)\n\n**Markdown-to-HTML**: Do NOT pass any `--theme` parameter when converting markdown to HTML. Use the default theme (no theme argument).\n\n**Article Workflow**:\n1. Opens `https://card.weibo.com/article/v3/editor`\n2. Clicks \"写文章\" button, waits for editor to become editable\n3. Fills title (validated for 32-char limit)\n4. Fills summary/导语 (validated for 44-char limit)\n5. Inserts HTML content into ProseMirror editor via paste\n6. Replaces image placeholders one by one (copy image → select placeholder → paste)\n\n**Post-Composition Check**: The script automatically verifies after all images are inserted:\n- Remaining `WBIMGPH_` placeholders in editor content\n- Expected vs actual image count\n\nIf the check fails (warnings in output), alert the user with the specific issues before they publish.\n\n---\n\n## Post Type Selection\n\nUnless the user explicitly specifies the post type:\n- **Markdown file** (`.md`) → **Headline Article** (头条文章)\n- **Plain text** / text with images → **Regular Post**\n\n## Troubleshooting\n\n### Chrome debug port not ready\n\nIf 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:\n\n```bash\npkill -f \"remote-debugging-port.*baoyu-skills/chrome-profile\" 2>/dev/null; sleep 2\n```\n\n**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.\n\n**Important**: This should be done automatically -- when encountering this error, kill the CDP Chrome instances and retry the command without asking the user.\n\n## Notes\n\n- First run: manual login required (session persists)\n- All scripts only fill content into the browser, user must review and publish manually\n- Cross-platform: macOS, Linux, Windows\n\n## Extension Support\n\nCustom configurations via EXTEND.md. See **Preferences** section for paths and supported options.","author":"@JimLiu","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/JimLiu/baoyu-skills/tree/main/skills/baoyu-post-to-weibo","license":"MIT","category":"writing","lang":"en","tokens":1256,"stars":0,"calls30d":1,"claimed":false,"visibility":"public","origin":"crawler","version":"0.1.0","createdAt":"2026-08-22","updatedAt":"2026-08-22","files":[{"path":"scripts/bun.lock","size":23715,"sha256":"7d13cdf9c902633b7bc25a63d83e25374a849fd909045458be0df2fb08c8a88d"},{"path":"scripts/copy-to-clipboard.ts","size":12179,"sha256":"fa22a29fc3d6b9e07024edadcfb504914d4adfc6d6c940738686f299b76613cd"},{"path":"scripts/md-to-html.ts","size":5816,"sha256":"f3d7fdaeb90751b9c59fa155898acfbac91e8a4503512374d6c5b74cfd938f7f"},{"path":"scripts/package.json","size":167,"sha256":"786555ddb607fa096581fde6e0cf30128415dff86f49127a8188a09beba7601f"},{"path":"scripts/paste-from-clipboard.ts","size":5659,"sha256":"c01606eb970dbe874af3d99a8ed228bda70936cfad1342d0a5a659921a5e2a06"},{"path":"scripts/weibo-article.ts","size":46976,"sha256":"2fc32a3b3f70afb794cf4ab26873acb17806f58137a7a8779ddc96e5c72a6133"},{"path":"scripts/weibo-post.ts","size":9788,"sha256":"c1d7e4421e634fa953c5cb21619c1696a46cfc23b5d03254a7b89a516370f91a"},{"path":"scripts/weibo-utils.ts","size":4557,"sha256":"4435c006df8264f8de8d6c47face9775bc7edc12976fe969ce6264c044618996"}],"requires":{"mcp":[],"tools":[]},"safety":{"flags":[{"code":"net.endpoints","kind":"exfiltration","excerpt":"card.weibo.com, weibo.com","message":"bundled scripts reach 2 external host(s)","severity":"warn"}],"scannedAt":"2026-08-22","hasScripts":true,"networkEndpoints":["card.weibo.com","weibo.com"]}}