twitter

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Twitter Skill (Read-Only)

Twitter 技能(只读)

Reads Twitter/X for financial research using twitter-cli, a command-line tool that accesses Twitter via browser cookie authentication.
This skill is read-only. It is designed for financial research: searching market discussions, reading analyst tweets, tracking sentiment, and monitoring financial news on Twitter/X. It does NOT support posting, liking, retweeting, replying, or any write operations.
Important: This tool uses your browser session cookies. No API keys needed — it authenticates via your logged-in browser session (Chrome, Arc, Edge, Firefox, Brave).

使用twitter-cli读取Twitter/X以开展金融研究,这是一款通过浏览器Cookie认证访问推特的命令行工具。
本技能为只读模式。它专为金融研究设计:搜索市场讨论内容、阅读分析师推文、追踪市场情绪,以及监控Twitter/X上的金融新闻。不支持发布、点赞、转发、回复或任何写入操作。
重要提示:本工具使用您的浏览器会话Cookie,无需API密钥——通过您已登录的浏览器会话(Chrome、Arc、Edge、Firefox、Brave)完成认证。

Step 1: Ensure twitter-cli Is Installed and Authenticated

步骤1:确保twitter-cli已安装并完成认证

Before running any command, install and check auth:
bash
undefined
运行任何命令前,请先安装并检查认证状态:
bash
undefined

Install (requires Python 3.10+)

Install (requires Python 3.10+)

command -v twitter || uv tool install twitter-cli
command -v twitter || uv tool install twitter-cli

Check authentication

Check authentication

twitter status --yaml >/dev/null && echo "AUTH_OK" || echo "AUTH_NEEDED"

If `AUTH_OK`, skip to Step 2. If `AUTH_NEEDED`, guide the user:
twitter status --yaml >/dev/null && echo "AUTH_OK" || echo "AUTH_NEEDED"

如果返回`AUTH_OK`,则跳至步骤2。如果返回`AUTH_NEEDED`,请引导用户按以下方式操作:

Authentication methods

认证方法

Method A: Browser cookie extraction (recommended)
Ensure user is logged into x.com in Arc/Chrome/Edge/Firefox/Brave. twitter-cli auto-extracts cookies. Verify with:
bash
twitter whoami
Chrome multi-profile: all profiles are scanned automatically. To specify one:
bash
TWITTER_CHROME_PROFILE="Profile 2" twitter feed
Method B: Environment variables
bash
export TWITTER_AUTH_TOKEN="<auth_token from browser>"
export TWITTER_CT0="<ct0 from browser>"
twitter whoami
方法A:浏览器Cookie提取(推荐)
确保用户已在Arc/Chrome/Edge/Firefox/Brave浏览器中登录x.com。twitter-cli会自动提取Cookie。可通过以下命令验证:
bash
twitter whoami
Chrome多配置文件:所有配置文件会被自动扫描。如需指定特定配置文件:
bash
TWITTER_CHROME_PROFILE="Profile 2" twitter feed
方法B:环境变量
bash
export TWITTER_AUTH_TOKEN="<auth_token from browser>"
export TWITTER_CT0="<ct0 from browser>"
twitter whoami

Common auth issues

常见认证问题

SymptomFix
No Twitter cookies found
Login to x.com in browser, or set env vars
Cookie expired (401/403)
Re-login to x.com and retry
Unable to get key for cookie decryption
(macOS)
Run
security unlock-keychain ~/Library/Keychains/login.keychain-db
for SSH, or allow Terminal in Keychain Access

症状解决方法
No Twitter cookies found
在浏览器中登录x.com,或设置环境变量
Cookie expired (401/403)
重新登录x.com后重试
Unable to get key for cookie decryption
(macOS)
运行
security unlock-keychain ~/Library/Keychains/login.keychain-db
(SSH环境下),或在钥匙串访问中允许终端访问

Step 2: Identify What the User Needs

步骤2:明确用户需求

Match the user's request to one of the read commands below, then use the corresponding command from
references/commands.md
.
User RequestCommandKey Flags
Auth check
twitter status
--yaml
Who am I
twitter whoami
--json
,
--yaml
Home feed / timeline
twitter feed
-t following
,
--max N
,
--full-text
,
--filter
Search tweets
twitter search "QUERY"
-t Latest
,
--from USER
,
--since DATE
,
--lang
,
--exclude retweets
,
--has links
,
--max N
Bookmarks
twitter bookmarks
--max N
,
--full-text
View a specific tweet
twitter tweet TWEET_ID_OR_URL
--full-text
Open tweet from last list
twitter show N
--full-text
,
--json
Twitter article
twitter article ID_OR_URL
--markdown
,
--output FILE
,
--json
List timeline
twitter list LIST_ID
--full-text
,
--max N
User profile
twitter user USERNAME
--json
User's tweets
twitter user-posts USERNAME
--max N
,
--full-text
,
-o FILE
User's likes
twitter likes USERNAME
own account only (private since Jun 2024)
Followers
twitter followers USERNAME
--max N
Following
twitter following USERNAME
--max N

将用户请求与下方的只读命令匹配,然后使用
references/commands.md
中的对应命令。
用户请求命令关键参数
检查认证状态
twitter status
--yaml
查看当前登录用户
twitter whoami
--json
,
--yaml
首页动态/时间线
twitter feed
-t following
,
--max N
,
--full-text
,
--filter
搜索推文
twitter search "QUERY"
-t Latest
,
--from USER
,
--since DATE
,
--lang
,
--exclude retweets
,
--has links
,
--max N
书签
twitter bookmarks
--max N
,
--full-text
查看特定推文
twitter tweet TWEET_ID_OR_URL
--full-text
打开最近列表中的第N条推文
twitter show N
--full-text
,
--json
推特文章
twitter article ID_OR_URL
--markdown
,
--output FILE
,
--json
列表时间线
twitter list LIST_ID
--full-text
,
--max N
用户资料
twitter user USERNAME
--json
用户推文
twitter user-posts USERNAME
--max N
,
--full-text
,
-o FILE
用户点赞内容
twitter likes USERNAME
仅支持自身账号(2024年6月起设为私有)
关注者列表
twitter followers USERNAME
--max N
关注列表
twitter following USERNAME
--max N

Step 3: Execute the Command

步骤3:执行命令

General pattern

通用模式

bash
undefined
bash
undefined

Use --yaml for structured output, -c for compact (token-efficient)

使用--yaml获取结构化输出,-c获取紧凑格式(节省Token)

twitter feed --yaml --max 20 twitter -c feed --max 10 # Compact: ~80% fewer tokens than --json
twitter feed --yaml --max 20 twitter -c feed --max 10 # 紧凑格式:比--json节省约80%的Token

Searching for financial topics

搜索金融类话题

twitter search "$AAPL earnings" -t Latest --max 10 --full-text --yaml twitter search "Fed rate decision" --since 2026-03-01 --max 20 --yaml twitter search "market crash" --exclude retweets --has links --max 15
undefined
twitter search "$AAPL earnings" -t Latest --max 10 --full-text --yaml twitter search "Fed rate decision" --since 2026-03-01 --max 20 --yaml twitter search "market crash" --exclude retweets --has links --max 15
undefined

Key rules

核心规则

  1. Check auth first — run
    twitter status --yaml
    before any other command
  2. Use
    --yaml
    or
    --json
    for structured output when processing data programmatically
  3. Use
    -c
    /
    --compact
    when token efficiency matters (LLM context)
  4. Use
    --full-text
    when the user wants complete tweet content (text is truncated by default in rich tables)
  5. Use
    --max N
    to limit results — start with 10-20 unless the user asks for more
  6. For search, use filters
    --from
    ,
    --since
    ,
    --lang
    ,
    --exclude retweets
    ,
    --has links
  7. Tweet IDs vs URLs — both work:
    twitter tweet 1234567890
    or
    twitter tweet https://x.com/user/status/1234567890
  8. Use
    twitter show N
    to reference tweet #N from the most recent list output
  9. NEVER execute write operations — this skill is read-only; do not post, like, retweet, reply, quote, follow, or delete
  1. 先检查认证 —— 在执行其他命令前,先运行
    twitter status --yaml
  2. 使用
    --yaml
    --json
    —— 当需要以编程方式处理数据时,使用结构化输出
  3. 使用
    -c
    /
    --compact
    —— 当Token效率很重要时(比如LLM上下文场景)
  4. 使用
    --full-text
    —— 当用户需要完整推文内容时(默认富表格会截断文本)
  5. 使用
    --max N
    —— 限制结果数量,除非用户要求更多,否则默认返回10-20条
  6. 搜索时使用筛选器 ——
    --from
    --since
    --lang
    --exclude retweets
    --has links
  7. 推文ID与URL —— 两种格式都支持:
    twitter tweet 1234567890
    twitter tweet https://x.com/user/status/1234567890
  8. 使用
    twitter show N
    —— 引用最近一次列表输出中的第N条推文
  9. 禁止执行写入操作 —— 本技能为只读模式;请勿执行发布、点赞、转发、回复、引用、关注或删除等操作

Output flags (all read commands)

输出参数(所有只读命令通用)

FlagPurpose
--json
JSON output
--yaml
YAML output (default in non-TTY)
--full-text
Show complete tweet text (rich table only)
-c
/
--compact
Minimal fields, great for LLM context
-o FILE
/
--output FILE
Save output to file
--input FILE
Read from previously saved JSON
参数用途
--json
JSON格式输出
--yaml
YAML格式输出(非TTY环境下默认使用)
--full-text
显示完整推文文本(仅富表格模式下有效)
-c
/
--compact
仅显示必要字段,非常适合LLM上下文场景
-o FILE
/
--output FILE
将输出保存至文件
--input FILE
从已保存的JSON文件中读取数据

Structured output envelope

结构化输出封装

All
--yaml
and
--json
output uses this envelope (see
references/schema.md
):
yaml
ok: true
schema_version: "1"
data: ...          # tweet/user lists or single objects
Error responses:
yaml
ok: false
schema_version: "1"
error:
  code: api_error
  message: "..."

所有
--yaml
--json
格式的输出均采用以下封装结构(详见
references/schema.md
):
yaml
ok: true
schema_version: "1"
data: ...          # tweet/user lists or single objects
错误响应格式:
yaml
ok: false
schema_version: "1"
error:
  code: api_error
  message: "..."

Step 4: Present the Results

步骤4:呈现结果

After fetching data, present it clearly for financial research:
  1. Summarize key content — highlight the most relevant tweets for the user's financial research
  2. Include attribution — show @username, tweet text, and engagement metrics (likes, retweets)
  3. Provide tweet IDs/URLs when the user might want to read the full thread
  4. For search results, group by relevance and highlight key themes, sentiment, or market signals
  5. For user profiles, present follower count, bio, and notable recent activity
  6. Flag sentiment — note bullish/bearish sentiment, consensus vs contrarian views
  7. Treat cookies as secrets — never echo cookie values to stdout

获取数据后,为金融研究清晰呈现结果:
  1. 总结核心内容 —— 突出与用户金融研究最相关的推文
  2. 添加归属信息 —— 显示@用户名、推文文本以及互动指标(点赞、转发数)
  3. 提供推文ID/URL —— 当用户可能需要阅读完整线程时
  4. 搜索结果分组 —— 按相关性分组,并突出关键主题、情绪或市场信号
  5. 用户资料呈现 —— 展示粉丝数、个人简介以及近期重要活动
  6. 标记情绪倾向 —— 标注看涨/看跌情绪、共识与对立观点
  7. Cookie保密 —— 切勿将Cookie值输出至标准输出流

Step 5: Diagnostics

步骤5:诊断

If something isn't working, run:
bash
twitter doctor
Reports version, OS, browser detection, keychain status, and cookie extraction results.
For verbose diagnostics on any command, add
-v
.

如果出现问题,运行以下命令:
bash
twitter doctor
该命令会报告版本、操作系统、浏览器检测结果、钥匙串状态以及Cookie提取结果。
如需对任意命令进行详细诊断,添加
-v
参数。

Error Reference

错误参考

ErrorCauseFix
No Twitter cookies found
Not authenticatedLogin to x.com in browser, or set env vars
HTTP 401/403Cookie expiredRe-login to x.com and retry
HTTP 404QueryId rotationRetry (auto-fallback built in)
HTTP 429Rate limitedWait 15+ minutes, then retry

错误原因解决方法
No Twitter cookies found
未完成认证在浏览器中登录x.com,或设置环境变量
HTTP 401/403Cookie过期重新登录x.com后重试
HTTP 404QueryId轮换重试(内置自动回退机制)
HTTP 429触发速率限制等待15分钟以上后重试

Proxy Configuration

代理配置

bash
export TWITTER_PROXY=http://127.0.0.1:7890
bash
export TWITTER_PROXY=http://127.0.0.1:7890

or

export TWITTER_PROXY=socks5://127.0.0.1:1080

---
export TWITTER_PROXY=socks5://127.0.0.1:1080

---

Reference Files

参考文件

  • references/commands.md
    — Complete read command reference with all flags, research workflows, and usage examples
  • references/schema.md
    — Structured output schema documentation
Read the reference files when you need exact command syntax, research workflow patterns, or schema details.
  • references/commands.md
    —— 完整的只读命令参考,包含所有参数、研究工作流及使用示例
  • references/schema.md
    —— 结构化输出的Schema文档
当您需要准确的命令语法、研究工作流模式或Schema细节时,请查阅这些参考文件。