← 返回
开发者工具 中文

X CDP Automation

Automate X (Twitter) via Chromium CDP: post tweets, reply, quote-retweet, publish articles. Uses real browser sessions with existing login, no API keys neede...
通过 Chromium CDP 自动化 X (Twitter):支持发推、回复、引用转发及发布文章。使用现有登录的真实浏览器会话,无需 API 密钥。
stwith stwith 来源
开发者工具 clawhub v1.0.0 1 版本 99906.7 Key: 无需
★ 6
Stars
📥 951
下载
💾 15
安装
1
版本
#automation#cdp#chromium#latest#puppeteer#twitter#x

概述

X CDP Skill — Browser Automation for X (Twitter)

First-Time Setup

Run the setup wizard. It checks everything and auto-fixes what it can:

node scripts/setup.js [--port 18802] [--profile ~/chromium-profiles/x-cdp]

The wizard does 4 things:

  1. Finds Chromium/Chrome on your system (or tells you how to install it)
  2. Checks puppeteer-core (auto-installs to /tmp/node_modules if missing)
  3. Launches Chromium with CDP enabled on the specified port
  4. Verifies X login (tells you to log in manually if needed)

Manual setup (if you prefer)

Install Chromium (recommended over Chrome for version stability):

# macOS
brew install --cask chromium

# Linux
sudo apt install chromium-browser

Install puppeteer-core:

cd /tmp && npm init -y && npm install puppeteer-core

Launch Chromium with CDP:

chromium --remote-debugging-port=18802 --user-data-dir=~/chromium-profiles/x-cdp --no-first-run

Log in to X: Open x.com in the Chromium window and log in once. The session persists in the profile directory.

Why Chromium, not Chrome?

Chrome auto-updates silently. One update can change DOM selectors and break all automation overnight. Chromium lets you pin a known-good version. That said, Chrome works fine too if you don't mind occasional breakage.

Architecture

All scripts connect to a running Chromium instance via CDP (Chrome DevTools Protocol).

This is not API-based. It drives the real browser UI, identical to a human clicking.

Multi-account isolation

Each X account gets its own Chromium instance with a separate port and profile:

  • Port 18800, profile chromium-profiles/main: @your_main_account
  • Port 18801, profile chromium-profiles/second: @your_second_account
  • Port 18802, profile chromium-profiles/third: @your_third_account

Launch multiple instances for multi-account use. All scripts accept --port to target a specific account.

Commands

Post a tweet

NODE_PATH=/tmp/node_modules node scripts/post-tweet.js "Hello world" [--image /path/to/img.png] [--port 18802] [--dry-run]

Reply to a tweet

NODE_PATH=/tmp/node_modules node scripts/reply-tweet.js <tweet_url> "Nice post!" [--image /path/to/img.png] [--port 18802] [--dry-run]

Quote retweet

NODE_PATH=/tmp/node_modules node scripts/quote-tweet.js <tweet_url> "My thoughts" [--port 18802] [--dry-run]

Publish an article (X Premium)

NODE_PATH=/tmp/node_modules node scripts/post-article.js --title "Title" --body "Body text" [--body-file /path/to/content.md] [--cover /path/to/cover.jpg] [--port 18800] [--dry-run]

All scripts support --dry-run to fill content without sending. A screenshot is saved to /tmp/.

Agent Integration

When the user asks to interact with X:

Pre-flight check

Before running any script, verify the environment:

  1. Check if Chromium is running on the target port: curl -s http://localhost:/json/version
  2. If not running, run node scripts/setup.js --port to launch and configure
  3. If setup fails, report the specific step that failed

Compose flow

  1. User provides intent (e.g., "reply to this tweet saying thanks")
  2. Agent drafts the text, shows it to user for approval
  3. On confirmation, run the script via exec
  4. Report success/failure

Error recovery

If a script fails with "not found" errors, X may have changed its DOM. Check and update:

  • references/selectors.md for the latest selectors
  • scripts/lib/cdp-utils.js SELECTORS object

Risk Notes

  • Rate limiting: Space out actions. No more than ~10 tweets/hour.
  • Detection: CDP automation looks like real browser usage. Much harder to detect than API abuse.
  • Account safety: Human-like delays are built into all scripts. Avoid bulk operations.
  • vs API tools (bird etc.): API wrappers get DMCA'd or break on API changes. CDP works as long as the website works.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 13:26 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

content-creation

Humanizer

biostartechnology
消除AI写作痕迹,使文本更自然真实。基于维基百科"AI写作特征"指南,识别并修正夸张象征、宣传用语、肤浅-ing分析、模糊归因、破折号滥用、三项排比、AI词汇、负面平行结构及冗长连接词等模式。
★ 886 📥 203,045
content-creation

humanizer-zh

liuxy951129-cpu
去除文本中的 AI 生成痕迹。适用于编辑或审阅文本,使其听起来更自然、更像人类书写。 基于维基百科的"AI 写作特征"综合指南。检测并修复以下模式:夸大的象征意义、 宣传性语言、以 -ing 结尾的肤浅分析、模糊的归因、破折号过度使用、三段
★ 56 📥 28,333
content-creation

Marketing Mode

thesethrose
{"answer":"营销模式整合23项全能技能,涵盖策略、心理、内容、SEO、转化优化及付费增长。适用于营销策略、文案、SEO、转化优化、付费广告及各类营销战术需求。"}
★ 161 📥 24,956