x

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

x — read & post on X (Twitter) via your own cookies

x — 通过自有Cookie读取和发布X(Twitter)内容

Drives the user's real X account through X's internal web API via
twikit
, authenticated by the login cookie they captured with the ACE extension. No official API key, no cost.
⚠️ Not yet E2E-verified. Built against twikit's documented API but not run against a live account at build time. The first live run is the verification — if X's internal API drifted it surfaces as a clear error, not silent breakage.
The connector injects the cookie jar as an env var:
  • X_COOKIES
    — a JSON array of cookies (needs at least
    auth_token
    +
    ct0
    ). Secret — full account access. Never echo or print it.
通过
twikit
调用X的内部Web API来操作用户的真实X账户,使用用户通过ACE扩展捕获的登录Cookie进行身份验证。无需官方API密钥,完全免费。
⚠️ 尚未完成端到端验证。基于twikit文档化的API构建,但在构建阶段未针对真实账户运行。首次实际运行即为验证过程——如果X的内部API发生变更,会直接显示明确错误,而非静默失效。
连接器会将Cookie Jar作为环境变量注入:
  • X_COOKIES
    — Cookie的JSON数组(至少需要
    auth_token
    +
    ct0
    )。 保密提示:拥有完整账户访问权限。切勿回显或打印该变量。

Setup — install twikit once per session

配置步骤——每个会话安装一次twikit

twikit
may not be preinstalled; bootstrap it (same pattern as the telegram skill), then call the shipped CLI:
sh
python3 -c "import twikit" 2>/dev/null || pip install --user --quiet twikit 2>/dev/null || true
X=$SKILL_DIR/scripts/x.py
python3 $X whoami          # who is logged in
twikit
可能未预装;按照与telegram技能相同的模式进行初始化,然后调用内置CLI:
sh
python3 -c "import twikit" 2>/dev/null || pip install --user --quiet twikit 2>/dev/null || true
X=$SKILL_DIR/scripts/x.py
python3 $X whoami          # 查看当前登录账户

Read commands (run directly)

读取类命令(直接运行)

sh
python3 $X whoami                                            # the logged-in account
python3 $X search --query "ai agents" --product Latest --limit 20   # Top | Latest | Media
python3 $X search-users --query "openai" --limit 10
python3 $X timeline --limit 20                               # my home timeline
python3 $X user-tweets --user elonmusk --type Tweets --limit 20     # Tweets|Replies|Media|Likes
python3 $X tweet --id 1234567890123456789                    # single tweet detail
python3 $X trends --category trending --limit 20             # trending|for-you|news|sports|entertainment
--user
accepts either an
@screen_name
(the
@
is optional) or a numeric id.
sh
python3 $X whoami                                            # 当前登录账户信息
python3 $X search --query "ai agents" --product Latest --limit 20   # 搜索选项:Top | Latest | Media
python3 $X search-users --query "openai" --limit 10
python3 $X timeline --limit 20                               # 我的主页时间线
python3 $X user-tweets --user elonmusk --type Tweets --limit 20     # 推文类型:Tweets|Replies|Media|Likes
python3 $X tweet --id 1234567890123456789                    # 单条推文详情
python3 $X trends --category trending --limit 20             # 趋势分类:trending|for-you|news|sports|entertainment
--user
参数接受
@screen_name
(@符号可选)或数字ID。

Verify the connection first

先验证连接

sh
python3 $X whoami
sh
python3 $X whoami

→ {"id": "...", "screen_name": "...", "followers_count": ...}

→ {"id": "...", "screen_name": "...", "followers_count": ...}


On an auth error the cookie is expired — have the user reconnect at
<https://auth.acedata.cloud/user/connections>. Do **not** loop-retry.

如果出现身份验证错误,说明Cookie已过期——请用户前往<https://auth.acedata.cloud/user/connections>重新连接。**请勿循环重试**。

Write commands — GATED (dry-run unless trailing
--confirm
)

写入类命令——受保护(无末尾
--confirm
则为试运行)

Every state-changing command (
post
,
thread
,
like
,
unlike
,
retweet
,
unretweet
,
follow
,
unfollow
,
delete
) dry-runs without a trailing
--confirm
.
--confirm
is honored only as the last argument, so a tweet body that merely contains "--confirm" can never silently post. Always show the dry-run, get an explicit "yes" on the exact text, then re-run with
--confirm
.
sh
python3 $X post --text "hello world"                          # dry-run
python3 $X post --text "hello world" --confirm                # LIVE tweet
python3 $X post --text "look at this" --media a.jpg,b.png --confirm     # up to 4 images (or 1 video)
python3 $X post --text "great point" --reply-to 123456 --confirm        # reply
python3 $X post --text "worth reading" --quote-url https://x.com/u/status/123 --confirm  # quote
python3 $X thread --text "1/2 first" --text "2/2 second" --confirm       # thread (2+ segments)
python3 $X like --id 123456 --confirm
python3 $X retweet --id 123456 --confirm
python3 $X follow --user elonmusk --confirm
python3 $X delete --id 123456 --confirm                        # delete one of MY tweets
  • A confirmed
    post
    /
    thread
    is immediately PUBLIC
    on the user's real account — there is no draft step. Always confirm the exact text first.
  • --media
    takes comma-separated file paths. X allows up to 4 images OR 1 video/GIF per tweet; for a thread the media attaches to the first segment only.
所有会改变状态的命令(
post
thread
like
unlike
retweet
unretweet
follow
unfollow
delete
如果末尾没有
--confirm
参数,则仅为试运行
--confirm
仅在作为最后一个参数时生效,因此推文内容中即使包含"--confirm"也不会意外发布。请始终先展示试运行结果,获取用户对确切内容的明确确认,再添加
--confirm
参数重新运行。
sh
python3 $X post --text "hello world"                          # 试运行
python3 $X post --text "hello world" --confirm                # 发布真实推文
python3 $X post --text "look at this" --media a.jpg,b.png --confirm     # 最多支持4张图片(或1个视频)
python3 $X post --text "great point" --reply-to 123456 --confirm        # 回复推文
python3 $X post --text "worth reading" --quote-url https://x.com/u/status/123 --confirm  # 引用推文
python3 $X thread --text "1/2 first" --text "2/2 second" --confirm       # 发布线程推文(2段及以上)
python3 $X like --id 123456 --confirm
python3 $X retweet --id 123456 --confirm
python3 $X follow --user elonmusk --confirm
python3 $X delete --id 123456 --confirm                        # 删除我的某条推文
  • 确认后的
    post
    /
    thread
    会立即在用户的真实账户上公开
    ——没有草稿步骤。请务必先确认确切内容。
  • --media
    接受逗号分隔的文件路径。X允许每条推文最多附加4张图片1个视频/GIF;对于线程推文,媒体仅会附加到第一段内容。

Gotchas

注意事项

  • This is the user's real X account. Confirm before any write — posts are immediate and public.
  • Not E2E-verified (see the warning above) — expect to validate the first run.
  • twikit is a scraper of X's non-public API. It can break when X changes its internal endpoints. A
    Couldn't get KEY_BYTE indices
    / transaction-id error means twikit needs upgrading:
    pip install --user -U twikit
    . An auth error means the cookie expired → reconnect.
  • ToS / rate-limit / ban risk. This acts through the web API, not the official API — high-frequency automation can get the account rate-limited or suspended. Keep volume human-like.
  • Never print
    X_COOKIES
    — it is full account access.
  • DMs are intentionally not exposed by this skill.
  • 这是用户的真实X账户。在执行任何写入操作前请确认——发布内容是即时且公开的。
  • 尚未完成端到端验证(见上方警告)——首次运行时需进行验证。
  • twikit是X非公开API的爬虫工具。当X更改内部端点时,该工具可能失效。如果出现
    Couldn't get KEY_BYTE indices
    /transaction-id错误,说明需要升级twikit:
    pip install --user -U twikit
    。如果出现身份验证错误,说明Cookie已过期→重新连接。
  • 存在服务条款违规/速率限制/账号封禁风险。本工具通过Web API而非官方API运行——高频自动化操作可能导致账号被限流或封禁。请保持操作频率接近人类行为。
  • 切勿打印
    X_COOKIES
    ——它拥有完整的账户访问权限。
  • 本技能刻意不支持私信功能

Record the output

记录输出结果

After you successfully publish and obtain the live result URL, call the built-in
publish_artifact
tool ONCE so the user can track this deliverable in My Outputs:
publish_artifact(kind="message", channel="x", title="<title>", url="<the REAL returned URL>", status="delivered")
Use the real returned URL — never fabricate one. Call it once per published item, only after delivery is confirmed; skip it (or use
status="failed"
) if publishing failed. See
_shared/artifacts.md
.
成功发布并获取真实结果URL后,调用内置的
publish_artifact
工具一次,以便用户在「我的输出」中跟踪该交付成果:
publish_artifact(kind="message", channel="x", title="<title>", url="<the REAL returned URL>", status="delivered")
请使用真实返回的URL——切勿伪造。每个发布项仅调用一次,且仅在确认交付成功后调用;如果发布失败,请跳过(或使用
status="failed"
)。详情请参阅
_shared/artifacts.md