feat: anti-detection hardening, transaction cache, article parsing, structured write output
Anti-detection:
- Add 6 sec-ch-ua-* Client Hints headers (arch, bitness, full-version, etc.)
- POST requests now send Referer: x.com/compose/post + Priority: u=1, i
- follow/unfollow REST adds include_profile_interstitial_type param
Performance:
- Transaction ID cache with 1h TTL (~/.twitter-cli/transaction_cache.json)
- resolve_user_id: auto-detect screen_name vs numeric user_id
Features:
- Twitter Article parsing: extract long-form content as Markdown
- Write operations emit structured JSON/YAML when piped or OUTPUT env set
ActionResult: {success, action, id, url, ...}
84 tests passing
This commit is contained in:
12
README.md
12
README.md
@@ -26,10 +26,10 @@ A terminal-first CLI for Twitter/X: read timelines, bookmarks, and user profiles
|
||||
- Tweet detail: view a tweet and its replies
|
||||
- List timeline: fetch tweets from a Twitter List
|
||||
- User lookup: fetch user profile, tweets, likes, followers, and following
|
||||
- JSON output: export any data for scripting and AI agent integration
|
||||
- Structured output: export any data as YAML or JSON for scripting and AI agent integration
|
||||
- Optional scoring filter: rank tweets by engagement weights
|
||||
|
||||
> **AI Agent Tip:** Always use `--json` for structured output instead of parsing the default rich-text display. Use `--max` to limit results.
|
||||
> **AI Agent Tip:** Prefer `--yaml` for structured output unless a strict JSON parser is required. Non-TTY stdout defaults to YAML automatically. Use `--max` to limit results.
|
||||
|
||||
**Write:**
|
||||
- Post: create new tweets and replies
|
||||
@@ -88,12 +88,12 @@ twitter feed --input tweets.json
|
||||
|
||||
# Bookmarks
|
||||
twitter bookmarks
|
||||
twitter bookmarks --max 30 --json
|
||||
twitter bookmarks --max 30 --yaml
|
||||
|
||||
# Search
|
||||
twitter search "Claude Code"
|
||||
twitter search "AI agent" -t Latest --max 50
|
||||
twitter search "机器学习" --json
|
||||
twitter search "机器学习" --yaml
|
||||
twitter search "topic" -o results.json # Save to file
|
||||
twitter search "trending" --filter # Apply ranking filter
|
||||
|
||||
@@ -294,9 +294,9 @@ After installation, OpenClaw can call `twitter-cli` commands directly.
|
||||
- 推文详情:查看推文及其回复
|
||||
- 列表时间线:获取 Twitter List 的推文
|
||||
- 用户查询:查看用户资料、推文、点赞、粉丝和关注
|
||||
- JSON 输出:便于脚本处理和 AI agent 集成
|
||||
- 结构化输出:支持 YAML 和 JSON,便于脚本处理和 AI agent 集成
|
||||
|
||||
> **AI Agent 提示:** 需要结构化输出时始终使用 `--json`,不要解析默认的富文本显示。用 `--max` 控制返回数量。
|
||||
> **AI Agent 提示:** 需要结构化输出时优先使用 `--yaml`,除非下游必须是 JSON。stdout 不是 TTY 时默认输出 YAML。用 `--max` 控制返回数量。
|
||||
|
||||
**写入:**
|
||||
- 发推:发布新推文和回复
|
||||
|
||||
Reference in New Issue
Block a user