canghe-post-to-x
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePost to X (Twitter)
发布至X(Twitter)
Posts text, images, videos, and long-form articles to X via real Chrome browser (bypasses anti-bot detection).
通过真实Chrome浏览器将文字、图片、视频及长文发布至X(绕过反机器人检测)。
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}
Script Reference:
| Script | Purpose |
|---|---|
| Regular posts (text + images) |
| Video posts (text + video) |
| Quote tweet with comment |
| Long-form article publishing (Markdown) |
| Markdown → HTML conversion |
| Copy content to clipboard |
| Send real paste keystroke |
| Verify environment & permissions |
重要提示:所有脚本均位于本Skill的子目录中。
scripts/Agent执行说明:
- 确定本SKILL.md文件的目录路径为
SKILL_DIR - 脚本路径 =
${SKILL_DIR}/scripts/<script-name>.ts - 将本文档中所有替换为实际路径
${SKILL_DIR}
脚本参考:
| 脚本 | 用途 |
|---|---|
| 常规推文(文字 + 图片) |
| 视频推文(文字 + 视频) |
| 带评论的引用推文 |
| 长文发布(Markdown格式) |
| Markdown → HTML转换 |
| 将内容复制到剪贴板 |
| 发送真实粘贴按键指令 |
| 验证环境与权限 |
Preferences (EXTEND.md)
偏好设置(EXTEND.md)
Use Bash to check EXTEND.md existence (priority order):
bash
undefined使用Bash检查EXTEND.md是否存在(优先级顺序):
bash
undefinedCheck project-level first
先检查项目级
test -f .canghe-skills/canghe-post-to-x/EXTEND.md && echo "project"
test -f .canghe-skills/canghe-post-to-x/EXTEND.md && echo "project"
Then user-level (cross-platform: $HOME works on macOS/Linux/WSL)
再检查用户级(跨平台:$HOME适用于macOS/Linux/WSL)
test -f "$HOME/.canghe-skills/canghe-post-to-x/EXTEND.md" && echo "user"
┌──────────────────────────────────────────────────┬───────────────────┐
│ Path │ Location │
├──────────────────────────────────────────────────┼───────────────────┤
│ .canghe-skills/canghe-post-to-x/EXTEND.md │ Project directory │
├──────────────────────────────────────────────────┼───────────────────┤
│ $HOME/.canghe-skills/canghe-post-to-x/EXTEND.md │ User home │
└──────────────────────────────────────────────────┴───────────────────┘
┌───────────┬───────────────────────────────────────────────────────────────────────────┐
│ Result │ Action │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ Found │ Read, parse, apply settings │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ Not found │ Use defaults │
└───────────┴───────────────────────────────────────────────────────────────────────────┘
**EXTEND.md Supports**: Default Chrome profiletest -f "$HOME/.canghe-skills/canghe-post-to-x/EXTEND.md" && echo "user"
┌──────────────────────────────────────────────────┬───────────────────┐
│ 路径 │ 位置 │
├──────────────────────────────────────────────────┼───────────────────┤
│ .canghe-skills/canghe-post-to-x/EXTEND.md │ 项目目录 │
├──────────────────────────────────────────────────┼───────────────────┤
│ $HOME/.canghe-skills/canghe-post-to-x/EXTEND.md │ 用户主目录 │
└──────────────────────────────────────────────────┴───────────────────┘
┌───────────┬───────────────────────────────────────────────────────────────────────────┐
│ 结果 │ 操作 │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ 找到 │ 读取、解析并应用设置 │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ 未找到 │ 使用默认设置 │
└───────────┴───────────────────────────────────────────────────────────────────────────┘
**EXTEND.md支持**:默认Chrome配置文件Prerequisites
前置要求
- Google Chrome or Chromium
- runtime
bun - First run: log in to X manually (session saved)
- Google Chrome或Chromium浏览器
- 运行时
bun - 首次运行:手动登录X(会话将被保存)
Pre-flight Check (Optional)
飞行前检查(可选)
Before first use, suggest running the environment check. User can skip if they prefer.
bash
npx -y bun ${SKILL_DIR}/scripts/check-paste-permissions.tsChecks: Chrome, profile isolation, Bun, Accessibility, clipboard, paste keystroke, Chrome conflicts.
If any check fails, provide fix guidance per item:
| Check | Fix |
|---|---|
| Chrome | Install Chrome or set |
| Profile dir | Ensure |
| Bun runtime | |
| Accessibility (macOS) | System Settings → Privacy & Security → Accessibility → enable terminal app |
| Clipboard copy | Ensure Swift/AppKit available (macOS Xcode CLI tools: |
| Paste keystroke (macOS) | Same as Accessibility fix above |
| Paste keystroke (Linux) | Install |
首次使用前,建议运行环境检查。用户可选择跳过。
bash
npx -y bun ${SKILL_DIR}/scripts/check-paste-permissions.ts检查内容:Chrome浏览器、配置文件隔离、Bun、辅助功能、剪贴板、粘贴按键指令、Chrome冲突。
若任何检查失败,根据对应项目提供修复指引:
| 检查项 | 修复方案 |
|---|---|
| Chrome | 安装Chrome或设置 |
| 配置文件目录 | 确保 |
| Bun运行时 | 执行 |
| 辅助功能(macOS) | 系统设置 → 隐私与安全性 → 辅助功能 → 启用终端应用 |
| 剪贴板复制 | 确保Swift/AppKit可用(macOS需安装Xcode CLI工具: |
| 粘贴按键指令(macOS) | 与上述辅助功能修复方案相同 |
| 粘贴按键指令(Linux) | 安装 |
References
参考文档
- Regular Posts: See for manual workflow, troubleshooting, and technical details
references/regular-posts.md - X Articles: See for long-form article publishing guide
references/articles.md
- 常规推文:查看获取手动流程、故障排除及技术细节
references/regular-posts.md - X长文:查看获取长文发布指南
references/articles.md
Regular Posts
常规推文
Text + up to 4 images.
bash
npx -y bun ${SKILL_DIR}/scripts/x-browser.ts "Hello!" --image ./photo.pngParameters:
| Parameter | Description |
|---|---|
| Post content (positional) |
| Image file (repeatable, max 4) |
| Custom Chrome profile |
Note: Script opens browser with content filled in. User reviews and publishes manually.
文字 + 最多4张图片。
bash
npx -y bun ${SKILL_DIR}/scripts/x-browser.ts "Hello!" --image ./photo.png参数:
| 参数 | 说明 |
|---|---|
| 推文内容(位置参数) |
| 图片文件(可重复使用,最多4张) |
| 自定义Chrome配置文件 |
注意:脚本会打开浏览器并填充内容,需用户审核后手动发布。
Video Posts
视频推文
Text + video file.
bash
npx -y bun ${SKILL_DIR}/scripts/x-video.ts "Check this out!" --video ./clip.mp4Parameters:
| Parameter | Description |
|---|---|
| Post content (positional) |
| Video file (MP4, MOV, WebM) |
| Custom Chrome profile |
Note: Script opens browser with content filled in. User reviews and publishes manually.
Limits: Regular 140s max, Premium 60min. Processing: 30-60s.
文字 + 视频文件。
bash
npx -y bun ${SKILL_DIR}/scripts/x-video.ts "Check this out!" --video ./clip.mp4参数:
| 参数 | 说明 |
|---|---|
| 推文内容(位置参数) |
| 视频文件(MP4、MOV、WebM格式) |
| 自定义Chrome配置文件 |
注意:脚本会打开浏览器并填充内容,需用户审核后手动发布。
限制:普通用户最长140秒,Premium用户最长60分钟。处理时间:30-60秒。
Quote Tweets
引用推文
Quote an existing tweet with comment.
bash
npx -y bun ${SKILL_DIR}/scripts/x-quote.ts https://x.com/user/status/123 "Great insight!"Parameters:
| Parameter | Description |
|---|---|
| URL to quote (positional) |
| Comment text (positional, optional) |
| Custom Chrome profile |
Note: Script opens browser with content filled in. User reviews and publishes manually.
引用现有推文并添加评论。
bash
npx -y bun ${SKILL_DIR}/scripts/x-quote.ts https://x.com/user/status/123 "Great insight!"参数:
| 参数 | 说明 |
|---|---|
| 要引用的推文URL(位置参数) |
| 评论文字(可选位置参数) |
| 自定义Chrome配置文件 |
注意:脚本会打开浏览器并填充内容,需用户审核后手动发布。
X Articles
X长文
Long-form Markdown articles (requires X Premium).
bash
npx -y bun ${SKILL_DIR}/scripts/x-article.ts article.md
npx -y bun ${SKILL_DIR}/scripts/x-article.ts article.md --cover ./cover.jpgParameters:
| Parameter | Description |
|---|---|
| Markdown file (positional) |
| Cover image |
| Override title |
Frontmatter: , supported in YAML front matter.
titlecover_imageNote: Script opens browser with article filled in. User reviews and publishes manually.
Markdown格式长文(需X Premium权限)。
bash
npx -y bun ${SKILL_DIR}/scripts/x-article.ts article.md
npx -y bun ${SKILL_DIR}/scripts/x-article.ts article.md --cover ./cover.jpg参数:
| 参数 | 说明 |
|---|---|
| Markdown文件(位置参数) |
| 封面图片 |
| 覆盖原标题 |
Frontmatter:支持在YAML前置元数据中设置、。
titlecover_image注意:脚本会打开浏览器并填充文章内容,需用户审核后手动发布。
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进行自定义配置。查看偏好设置部分获取路径及支持选项。