baoyu-post-to-x
💡 摘要
此技能允许用户使用真实的Chrome浏览器向X(Twitter)发布各种类型的内容。
🎯 适合人群
🤖 AI 吐槽: “看起来很能打,但别让配置把人劝退。”
风险:Medium。建议检查:是否执行 shell/命令行指令;是否发起外网请求(SSRF/数据外发);文件读写范围与路径穿越风险。以最小权限运行,并在生产环境启用前审计代码与依赖。
name: baoyu-post-to-x description: Post content and articles to X (Twitter). Supports regular posts with images/videos and X Articles (long-form Markdown). Uses real Chrome with CDP to bypass anti-automation.
Post to X (Twitter)
Post content, images, videos, and long-form articles to X using 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
SKILL_DIR - Script path =
${SKILL_DIR}/scripts/<script-name>.ts - Replace all
${SKILL_DIR}in this document with the actual path
Script Reference:
| Script | Purpose |
|--------|---------|
| scripts/x-browser.ts | Regular posts (text + images) |
| scripts/x-video.ts | Video posts (text + video) |
| scripts/x-quote.ts | Quote tweet with comment |
| scripts/x-article.ts | Long-form article publishing (Markdown) |
| scripts/md-to-html.ts | Markdown → HTML conversion |
| scripts/copy-to-clipboard.ts | Copy content to clipboard |
| scripts/paste-from-clipboard.ts | Send real paste keystroke |
Prerequisites
- Google Chrome or Chromium installed
buninstalled (for running scripts)- First run: log in to X in the opened browser window
References
- Regular Posts: See
references/regular-posts.mdfor manual workflow, troubleshooting, and technical details - X Articles: See
references/articles.mdfor long-form article publishing guide
Regular Posts
Text + up to 4 images.
# Preview mode (doesn't post) npx -y bun ${SKILL_DIR}/scripts/x-browser.ts "Hello from Claude!" --image ./screenshot.png # Actually post npx -y bun ${SKILL_DIR}/scripts/x-browser.ts "Hello!" --image ./photo.png --submit
Note:
${SKILL_DIR}represents this skill's installation directory. Agent replaces with actual path at runtime.
Parameters:
| Parameter | Description |
|-----------|-------------|
| <text> | Post content (positional argument) |
| --image <path> | Image file path (can be repeated, max 4) |
| --submit | Actually post (default: preview only) |
| --profile <dir> | Custom Chrome profile directory |
Video Posts
Text + video file (MP4, MOV, WebM).
# Preview mode (doesn't post) npx -y bun ${SKILL_DIR}/scripts/x-video.ts "Check out this video!" --video ./clip.mp4 # Actually post npx -y bun ${SKILL_DIR}/scripts/x-video.ts "Amazing content" --video ./demo.mp4 --submit
Parameters:
| Parameter | Description |
|-----------|-------------|
| <text> | Post content (positional argument) |
| --video <path> | Video file path (required) |
| --submit | Actually post (default: preview only) |
| --profile <dir> | Custom Chrome profile directory |
Video Limits:
- Regular accounts: 140 seconds max
- X Premium: up to 60 minutes
- Supported formats: MP4, MOV, WebM
- Processing time: 30-60 seconds depending on file size
Quote Tweets
Quote an existing tweet with your comment - a way to share content while giving credit to the original creator.
# Preview mode (doesn't post) npx -y bun ${SKILL_DIR}/scripts/x-quote.ts https://x.com/user/status/123456789 "Great insight!" # Actually post npx -y bun ${SKILL_DIR}/scripts/x-quote.ts https://x.com/user/status/123456789 "I agree!" --submit
Parameters:
| Parameter | Description |
|-----------|-------------|
| <tweet-url> | URL of the tweet to quote (positional argument) |
| <comment> | Your comment text (positional argument, optional) |
| --submit | Actually post (default: preview only) |
| --profile <dir> | Custom Chrome profile directory |
X Articles
Long-form Markdown articles (requires X Premium).
# Preview mode npx -y bun ${SKILL_DIR}/scripts/x-article.ts article.md # With cover image npx -y bun ${SKILL_DIR}/scripts/x-article.ts article.md --cover ./cover.jpg # Publish npx -y bun ${SKILL_DIR}/scripts/x-article.ts article.md --submit
Parameters:
| Parameter | Description |
|-----------|-------------|
| <markdown> | Markdown file path (positional argument) |
| --cover <path> | Cover image path |
| --title <text> | Override article title |
| --submit | Actually publish (default: preview only) |
Frontmatter (optional):
--- title: My Article Title cover_image: /path/to/cover.jpg ---
Notes
- First run requires manual login (session is saved)
- Always preview before using
--submit - Browser closes automatically after operation
- Supports macOS, Linux, and Windows
Extension Support
Custom configurations via EXTEND.md.
Check paths (priority order):
.baoyu-skills/baoyu-post-to-x/EXTEND.md(project)~/.baoyu-skills/baoyu-post-to-x/EXTEND.md(user)
If found, load before workflow. Extension content overrides defaults.
优点
- 使用真实的Chrome浏览器绕过反机器人检测。
- 支持多种内容类型,包括图片、视频和文章。
- 使用简单,命令结构清晰。
缺点
- 首次使用时需要手动登录。
- 依赖于Chrome和bun等外部工具。
- 长格式文章仅限于X Premium用户。
相关技能
免责声明:本内容来源于 GitHub 开源项目,仅供展示和评分分析使用。
版权归原作者所有 JimLiu.
