twitter-cli 0.6.3__tar.gz → 0.6.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/.github/ISSUE_TEMPLATE/bug_report.yml +31 -0
  2. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/PKG-INFO +68 -1
  3. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/README.md +67 -0
  4. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/SCHEMA.md +14 -0
  5. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/SKILL.md +24 -0
  6. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/pyproject.toml +1 -1
  7. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/tests/conftest.py +2 -0
  8. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/tests/test_auth.py +115 -9
  9. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/tests/test_cli.py +134 -1
  10. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/tests/test_client.py +49 -0
  11. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/tests/test_serialization.py +13 -0
  12. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/twitter_cli/auth.py +105 -30
  13. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/twitter_cli/cli.py +249 -32
  14. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/twitter_cli/client.py +61 -6
  15. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/twitter_cli/constants.py +21 -2
  16. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/twitter_cli/formatter.py +62 -3
  17. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/twitter_cli/graphql.py +2 -1
  18. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/uv.lock +1 -1
  19. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  20. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/.github/workflows/ci.yml +0 -0
  21. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/.github/workflows/publish-clawhub.yml +0 -0
  22. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/.github/workflows/publish.yml +0 -0
  23. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/.gitignore +0 -0
  24. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/LICENSE +0 -0
  25. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/config.yaml +0 -0
  26. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/tests/fixtures/followers_page.json +0 -0
  27. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/tests/fixtures/home_timeline.json +0 -0
  28. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/tests/fixtures/list_timeline.json +0 -0
  29. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/tests/fixtures/search_timeline.json +0 -0
  30. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/tests/fixtures/tweet_detail.json +0 -0
  31. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/tests/test_config.py +0 -0
  32. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/tests/test_config_normalization.py +0 -0
  33. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/tests/test_filter.py +0 -0
  34. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/tests/test_parser_fixtures.py +0 -0
  35. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/tests/test_smoke.py +0 -0
  36. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/twitter_cli/__init__.py +0 -0
  37. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/twitter_cli/config.py +0 -0
  38. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/twitter_cli/exceptions.py +0 -0
  39. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/twitter_cli/filter.py +0 -0
  40. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/twitter_cli/models.py +0 -0
  41. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/twitter_cli/output.py +0 -0
  42. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/twitter_cli/parser.py +0 -0
  43. {twitter_cli-0.6.3 → twitter_cli-0.6.6}/twitter_cli/serialization.py +0 -0
@@ -21,6 +21,31 @@ body:
21
21
  - Other
22
22
  validations:
23
23
  required: true
24
+ - type: dropdown
25
+ id: browser
26
+ attributes:
27
+ label: Browser (for cookie extraction)
28
+ options:
29
+ - Arc
30
+ - Chrome
31
+ - Edge
32
+ - Firefox
33
+ - Brave
34
+ - Other / N/A (using env vars)
35
+ validations:
36
+ required: true
37
+ - type: dropdown
38
+ id: access_method
39
+ attributes:
40
+ label: Access Method
41
+ description: How are you accessing the machine where twitter-cli runs?
42
+ options:
43
+ - Local terminal
44
+ - SSH
45
+ - Docker / container
46
+ - Other
47
+ validations:
48
+ required: true
24
49
  - type: textarea
25
50
  id: description
26
51
  attributes:
@@ -41,6 +66,12 @@ body:
41
66
  label: Steps to reproduce
42
67
  description: "Commands or steps to reproduce the issue. Use `twitter -v <command>` for debug output."
43
68
  render: bash
69
+ - type: textarea
70
+ id: diagnostics
71
+ attributes:
72
+ label: Diagnostics
73
+ description: "Paste the output of `twitter doctor` here. This helps us diagnose cookie and auth issues quickly."
74
+ render: text
44
75
  - type: textarea
45
76
  id: logs
46
77
  attributes:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: twitter-cli
3
- Version: 0.6.3
3
+ Version: 0.6.6
4
4
  Summary: A CLI for Twitter/X — feed, bookmarks, and user timeline in terminal
5
5
  Project-URL: Homepage, https://github.com/jackwener/twitter-cli
6
6
  Project-URL: Repository, https://github.com/jackwener/twitter-cli
@@ -56,8 +56,10 @@ A terminal-first CLI for Twitter/X: read timelines, bookmarks, and user profiles
56
56
  - Bookmarks: list saved tweets from your account
57
57
  - Search: find tweets by keyword with Top/Latest/Photos/Videos tabs
58
58
  - Tweet detail: view a tweet and its replies
59
+ - Article: fetch a Twitter Article and export it as Markdown
59
60
  - List timeline: fetch tweets from a Twitter List
60
61
  - User lookup: fetch user profile, tweets, likes, followers, and following
62
+ - `--full-text`: disable tweet text truncation in rich table output
61
63
  - Structured output: export any data as YAML or JSON for scripting and AI agent integration
62
64
  - Optional scoring filter: rank tweets by engagement weights
63
65
  - Structured output contract: [SCHEMA.md](./SCHEMA.md)
@@ -126,32 +128,45 @@ twitter feed --filter
126
128
  ```bash
127
129
  # Feed
128
130
  twitter feed --max 50
131
+ twitter feed --full-text
129
132
  twitter feed --json > tweets.json
130
133
  twitter feed --input tweets.json
131
134
 
132
135
  # Bookmarks
133
136
  twitter bookmarks
137
+ twitter bookmarks --full-text
134
138
  twitter bookmarks --max 30 --yaml
135
139
 
136
140
  # Search
137
141
  twitter search "Claude Code"
138
142
  twitter search "AI agent" -t Latest --max 50
143
+ twitter search "AI agent" --full-text
139
144
  twitter search "机器学习" --yaml
140
145
  twitter search "topic" -o results.json # Save to file
141
146
  twitter search "trending" --filter # Apply ranking filter
142
147
 
143
148
  # Tweet detail (view tweet + replies)
144
149
  twitter tweet 1234567890
150
+ twitter tweet 1234567890 --full-text
145
151
  twitter tweet https://x.com/user/status/1234567890
146
152
 
153
+ # Twitter Article
154
+ twitter article 1234567890
155
+ twitter article https://x.com/user/article/1234567890 --json
156
+ twitter article 1234567890 --markdown
157
+ twitter article 1234567890 --output article.md
158
+
147
159
  # List timeline
148
160
  twitter list 1539453138322673664
161
+ twitter list 1539453138322673664 --full-text
149
162
 
150
163
  # User
151
164
  twitter user elonmusk
152
165
  twitter user-posts elonmusk --max 20
166
+ twitter user-posts elonmusk --full-text
153
167
  twitter user-posts elonmusk -o tweets.json
154
168
  twitter likes elonmusk --max 30 # ⚠️ own likes only (private since Jun 2024)
169
+ twitter likes elonmusk --full-text
155
170
  twitter likes elonmusk -o likes.json
156
171
  twitter followers elonmusk --max 50
157
172
  twitter following elonmusk --max 50
@@ -233,6 +248,7 @@ rateLimit:
233
248
  Fetch behavior:
234
249
 
235
250
  - `fetch.count` is the default item count for read commands when `--max` is omitted
251
+ - Rich table output truncates long tweet text by default; use `--full-text` to show full body text in list views
236
252
 
237
253
  Filter behavior:
238
254
 
@@ -263,6 +279,13 @@ Mode behavior:
263
279
  - **Use browser cookie extraction** — provides full cookie fingerprint
264
280
  - **Avoid datacenter IPs** — residential proxies are much safer
265
281
 
282
+ ### Output Modes
283
+
284
+ - Use the default rich table for interactive reading
285
+ - Use `--full-text` when reading long posts in terminal tables
286
+ - Use `--yaml` or `--json` for scripts and agent pipelines
287
+ - Use `-c` / `--compact` when token efficiency matters more than completeness
288
+
266
289
  ### Troubleshooting
267
290
 
268
291
  - `No Twitter cookies found`
@@ -273,6 +296,14 @@ Mode behavior:
273
296
  - `Cookie expired or invalid (HTTP 401/403)`
274
297
  - Re-login to `x.com` and retry.
275
298
 
299
+ - `Unable to get key for cookie decryption` (macOS Keychain)
300
+ - **SSH sessions**: Keychain is locked by default over SSH. Run:
301
+ ```bash
302
+ security unlock-keychain ~/Library/Keychains/login.keychain-db
303
+ ```
304
+ - **Local terminal**: Open **Keychain Access** → search for **"\<Browser\> Safe Storage"** → **Access Control** → add your Terminal app → **Save Changes**.
305
+ - Or click **"Always Allow"** when the Keychain authorization popup appears.
306
+
276
307
  - `Twitter API error 404`
277
308
  - This can happen when upstream GraphQL query IDs rotate.
278
309
  - Retry the command; the client attempts a live queryId fallback.
@@ -280,6 +311,8 @@ Mode behavior:
280
311
  - `Invalid tweet JSON file`
281
312
  - Regenerate input using `twitter feed --json > tweets.json`.
282
313
 
314
+ **Diagnostics command**: Run `twitter doctor` to output a full diagnostic report (version, OS, browser detection, Keychain status, cookie extraction results). Paste this output into bug reports.
315
+
283
316
  Structured error codes commonly include `not_authenticated`, `not_found`, `invalid_input`, `rate_limited`, and `api_error`.
284
317
 
285
318
  ### Development
@@ -350,8 +383,10 @@ After installation, OpenClaw can call `twitter-cli` commands directly.
350
383
  - 收藏读取:查看账号书签推文
351
384
  - 搜索:按关键词搜索推文,支持 Top/Latest/Photos/Videos
352
385
  - 推文详情:查看推文及其回复
386
+ - 文章读取:获取 Twitter 长文,并导出为 Markdown
353
387
  - 列表时间线:获取 Twitter List 的推文
354
388
  - 用户查询:查看用户资料、推文、点赞、粉丝和关注
389
+ - `--full-text`:在 rich table 输出里关闭推文正文截断
355
390
  - 结构化输出:支持 YAML 和 JSON,便于脚本处理和 AI agent 集成
356
391
 
357
392
  > **AI Agent 提示:** 需要结构化输出时优先使用 `--yaml`,除非下游必须是 JSON。stdout 不是 TTY 时默认输出 YAML。用 `--max` 控制返回数量。
@@ -396,27 +431,40 @@ uv tool upgrade twitter-cli
396
431
  twitter feed
397
432
  twitter feed -t following
398
433
  twitter feed --filter
434
+ twitter feed --full-text
399
435
 
400
436
  # 收藏
401
437
  twitter bookmarks
438
+ twitter bookmarks --full-text
402
439
 
403
440
  # 搜索
404
441
  twitter search "Claude Code"
405
442
  twitter search "AI agent" -t Latest --max 50
443
+ twitter search "AI agent" --full-text
406
444
  twitter search "topic" -o results.json # 保存到文件
407
445
  twitter search "trending" --filter # 启用排序筛选
408
446
 
409
447
  # 推文详情
410
448
  twitter tweet 1234567890
449
+ twitter tweet 1234567890 --full-text
450
+
451
+ # Twitter 长文
452
+ twitter article 1234567890
453
+ twitter article https://x.com/user/article/1234567890 --json
454
+ twitter article 1234567890 --markdown
455
+ twitter article 1234567890 --output article.md
411
456
 
412
457
  # 列表时间线
413
458
  twitter list 1539453138322673664
459
+ twitter list 1539453138322673664 --full-text
414
460
 
415
461
  # 用户
416
462
  twitter user elonmusk
417
463
  twitter user-posts elonmusk --max 20
464
+ twitter user-posts elonmusk --full-text
418
465
  twitter user-posts elonmusk -o tweets.json
419
466
  twitter likes elonmusk --max 30 # ⚠️ 仅可查看自己的点赞(2024年6月起平台已私密化)
467
+ twitter likes elonmusk --full-text
420
468
  twitter likes elonmusk -o likes.json
421
469
  twitter followers elonmusk
422
470
  twitter following elonmusk
@@ -467,6 +515,8 @@ export TWITTER_PROXY=socks5://127.0.0.1:1080
467
515
 
468
516
  未传 `--max` 时,所有读取命令默认使用 `config.yaml` 里的 `fetch.count`。
469
517
 
518
+ rich table 输出默认会截断较长正文;如果需要在列表视图中查看完整正文,可加 `--full-text`。
519
+
470
520
  只有在传入 `--filter` 时才会启用筛选评分;默认不筛选。
471
521
 
472
522
  评分公式:
@@ -490,7 +540,17 @@ score = likes_w * likes
490
540
  - 报错 `No Twitter cookies found`:请先登录 `x.com`,并确认浏览器为 Arc/Chrome/Edge/Firefox/Brave 之一,或手动设置环境变量。
491
541
  - 如需查看浏览器提取细节,可加 `-v` 打开诊断日志。
492
542
  - 报错 `Cookie expired or invalid`:Cookie 过期,重新登录后重试。
543
+ - 报错 `Unable to get key for cookie decryption`(macOS Keychain 问题):
544
+ - **SSH 远程登录**:Keychain 默认锁定,需手动解锁:
545
+ ```bash
546
+ security unlock-keychain ~/Library/Keychains/login.keychain-db
547
+ ```
548
+ - **本地终端**:打开 **钥匙串访问** → 搜索 **"\<浏览器\> Safe Storage"** → **访问控制** → 添加你的终端 app → **保存更改**。
549
+ - 或在弹出 Keychain 授权时点击 **"始终允许"**。
493
550
  - 报错 `Twitter API error 404`:通常是 queryId 轮换,重试即可。
551
+
552
+ **诊断命令**:运行 `twitter doctor` 可输出完整诊断报告(版本、OS、浏览器检测、Keychain 状态、cookie 提取结果),方便提交 bug report。
553
+
494
554
  - 结构化错误码通常会区分 `not_authenticated`、`not_found`、`invalid_input`、`rate_limited`、`api_error`。
495
555
 
496
556
  ### 使用建议(防封号)
@@ -502,6 +562,13 @@ score = likes_w * likes
502
562
  - **避免数据中心 IP** — 住宅代理更安全
503
563
  - Cookie 仅在本地使用,不会被本工具上传
504
564
 
565
+ ### 输出模式建议
566
+
567
+ - 默认 rich table 适合终端交互式浏览
568
+ - 需要在表格里看完整正文时,使用 `--full-text`
569
+ - 需要脚本消费时,优先使用 `--yaml` 或 `--json`
570
+ - 需要节省 token 时,使用 `-c` / `--compact`
571
+
505
572
  ### 作为 AI Agent Skill 使用
506
573
 
507
574
  twitter-cli 提供了 [`SKILL.md`](./SKILL.md),可让 AI Agent 更稳定地调用本工具。
@@ -24,8 +24,10 @@ A terminal-first CLI for Twitter/X: read timelines, bookmarks, and user profiles
24
24
  - Bookmarks: list saved tweets from your account
25
25
  - Search: find tweets by keyword with Top/Latest/Photos/Videos tabs
26
26
  - Tweet detail: view a tweet and its replies
27
+ - Article: fetch a Twitter Article and export it as Markdown
27
28
  - List timeline: fetch tweets from a Twitter List
28
29
  - User lookup: fetch user profile, tweets, likes, followers, and following
30
+ - `--full-text`: disable tweet text truncation in rich table output
29
31
  - Structured output: export any data as YAML or JSON for scripting and AI agent integration
30
32
  - Optional scoring filter: rank tweets by engagement weights
31
33
  - Structured output contract: [SCHEMA.md](./SCHEMA.md)
@@ -94,32 +96,45 @@ twitter feed --filter
94
96
  ```bash
95
97
  # Feed
96
98
  twitter feed --max 50
99
+ twitter feed --full-text
97
100
  twitter feed --json > tweets.json
98
101
  twitter feed --input tweets.json
99
102
 
100
103
  # Bookmarks
101
104
  twitter bookmarks
105
+ twitter bookmarks --full-text
102
106
  twitter bookmarks --max 30 --yaml
103
107
 
104
108
  # Search
105
109
  twitter search "Claude Code"
106
110
  twitter search "AI agent" -t Latest --max 50
111
+ twitter search "AI agent" --full-text
107
112
  twitter search "机器学习" --yaml
108
113
  twitter search "topic" -o results.json # Save to file
109
114
  twitter search "trending" --filter # Apply ranking filter
110
115
 
111
116
  # Tweet detail (view tweet + replies)
112
117
  twitter tweet 1234567890
118
+ twitter tweet 1234567890 --full-text
113
119
  twitter tweet https://x.com/user/status/1234567890
114
120
 
121
+ # Twitter Article
122
+ twitter article 1234567890
123
+ twitter article https://x.com/user/article/1234567890 --json
124
+ twitter article 1234567890 --markdown
125
+ twitter article 1234567890 --output article.md
126
+
115
127
  # List timeline
116
128
  twitter list 1539453138322673664
129
+ twitter list 1539453138322673664 --full-text
117
130
 
118
131
  # User
119
132
  twitter user elonmusk
120
133
  twitter user-posts elonmusk --max 20
134
+ twitter user-posts elonmusk --full-text
121
135
  twitter user-posts elonmusk -o tweets.json
122
136
  twitter likes elonmusk --max 30 # ⚠️ own likes only (private since Jun 2024)
137
+ twitter likes elonmusk --full-text
123
138
  twitter likes elonmusk -o likes.json
124
139
  twitter followers elonmusk --max 50
125
140
  twitter following elonmusk --max 50
@@ -201,6 +216,7 @@ rateLimit:
201
216
  Fetch behavior:
202
217
 
203
218
  - `fetch.count` is the default item count for read commands when `--max` is omitted
219
+ - Rich table output truncates long tweet text by default; use `--full-text` to show full body text in list views
204
220
 
205
221
  Filter behavior:
206
222
 
@@ -231,6 +247,13 @@ Mode behavior:
231
247
  - **Use browser cookie extraction** — provides full cookie fingerprint
232
248
  - **Avoid datacenter IPs** — residential proxies are much safer
233
249
 
250
+ ### Output Modes
251
+
252
+ - Use the default rich table for interactive reading
253
+ - Use `--full-text` when reading long posts in terminal tables
254
+ - Use `--yaml` or `--json` for scripts and agent pipelines
255
+ - Use `-c` / `--compact` when token efficiency matters more than completeness
256
+
234
257
  ### Troubleshooting
235
258
 
236
259
  - `No Twitter cookies found`
@@ -241,6 +264,14 @@ Mode behavior:
241
264
  - `Cookie expired or invalid (HTTP 401/403)`
242
265
  - Re-login to `x.com` and retry.
243
266
 
267
+ - `Unable to get key for cookie decryption` (macOS Keychain)
268
+ - **SSH sessions**: Keychain is locked by default over SSH. Run:
269
+ ```bash
270
+ security unlock-keychain ~/Library/Keychains/login.keychain-db
271
+ ```
272
+ - **Local terminal**: Open **Keychain Access** → search for **"\<Browser\> Safe Storage"** → **Access Control** → add your Terminal app → **Save Changes**.
273
+ - Or click **"Always Allow"** when the Keychain authorization popup appears.
274
+
244
275
  - `Twitter API error 404`
245
276
  - This can happen when upstream GraphQL query IDs rotate.
246
277
  - Retry the command; the client attempts a live queryId fallback.
@@ -248,6 +279,8 @@ Mode behavior:
248
279
  - `Invalid tweet JSON file`
249
280
  - Regenerate input using `twitter feed --json > tweets.json`.
250
281
 
282
+ **Diagnostics command**: Run `twitter doctor` to output a full diagnostic report (version, OS, browser detection, Keychain status, cookie extraction results). Paste this output into bug reports.
283
+
251
284
  Structured error codes commonly include `not_authenticated`, `not_found`, `invalid_input`, `rate_limited`, and `api_error`.
252
285
 
253
286
  ### Development
@@ -318,8 +351,10 @@ After installation, OpenClaw can call `twitter-cli` commands directly.
318
351
  - 收藏读取:查看账号书签推文
319
352
  - 搜索:按关键词搜索推文,支持 Top/Latest/Photos/Videos
320
353
  - 推文详情:查看推文及其回复
354
+ - 文章读取:获取 Twitter 长文,并导出为 Markdown
321
355
  - 列表时间线:获取 Twitter List 的推文
322
356
  - 用户查询:查看用户资料、推文、点赞、粉丝和关注
357
+ - `--full-text`:在 rich table 输出里关闭推文正文截断
323
358
  - 结构化输出:支持 YAML 和 JSON,便于脚本处理和 AI agent 集成
324
359
 
325
360
  > **AI Agent 提示:** 需要结构化输出时优先使用 `--yaml`,除非下游必须是 JSON。stdout 不是 TTY 时默认输出 YAML。用 `--max` 控制返回数量。
@@ -364,27 +399,40 @@ uv tool upgrade twitter-cli
364
399
  twitter feed
365
400
  twitter feed -t following
366
401
  twitter feed --filter
402
+ twitter feed --full-text
367
403
 
368
404
  # 收藏
369
405
  twitter bookmarks
406
+ twitter bookmarks --full-text
370
407
 
371
408
  # 搜索
372
409
  twitter search "Claude Code"
373
410
  twitter search "AI agent" -t Latest --max 50
411
+ twitter search "AI agent" --full-text
374
412
  twitter search "topic" -o results.json # 保存到文件
375
413
  twitter search "trending" --filter # 启用排序筛选
376
414
 
377
415
  # 推文详情
378
416
  twitter tweet 1234567890
417
+ twitter tweet 1234567890 --full-text
418
+
419
+ # Twitter 长文
420
+ twitter article 1234567890
421
+ twitter article https://x.com/user/article/1234567890 --json
422
+ twitter article 1234567890 --markdown
423
+ twitter article 1234567890 --output article.md
379
424
 
380
425
  # 列表时间线
381
426
  twitter list 1539453138322673664
427
+ twitter list 1539453138322673664 --full-text
382
428
 
383
429
  # 用户
384
430
  twitter user elonmusk
385
431
  twitter user-posts elonmusk --max 20
432
+ twitter user-posts elonmusk --full-text
386
433
  twitter user-posts elonmusk -o tweets.json
387
434
  twitter likes elonmusk --max 30 # ⚠️ 仅可查看自己的点赞(2024年6月起平台已私密化)
435
+ twitter likes elonmusk --full-text
388
436
  twitter likes elonmusk -o likes.json
389
437
  twitter followers elonmusk
390
438
  twitter following elonmusk
@@ -435,6 +483,8 @@ export TWITTER_PROXY=socks5://127.0.0.1:1080
435
483
 
436
484
  未传 `--max` 时,所有读取命令默认使用 `config.yaml` 里的 `fetch.count`。
437
485
 
486
+ rich table 输出默认会截断较长正文;如果需要在列表视图中查看完整正文,可加 `--full-text`。
487
+
438
488
  只有在传入 `--filter` 时才会启用筛选评分;默认不筛选。
439
489
 
440
490
  评分公式:
@@ -458,7 +508,17 @@ score = likes_w * likes
458
508
  - 报错 `No Twitter cookies found`:请先登录 `x.com`,并确认浏览器为 Arc/Chrome/Edge/Firefox/Brave 之一,或手动设置环境变量。
459
509
  - 如需查看浏览器提取细节,可加 `-v` 打开诊断日志。
460
510
  - 报错 `Cookie expired or invalid`:Cookie 过期,重新登录后重试。
511
+ - 报错 `Unable to get key for cookie decryption`(macOS Keychain 问题):
512
+ - **SSH 远程登录**:Keychain 默认锁定,需手动解锁:
513
+ ```bash
514
+ security unlock-keychain ~/Library/Keychains/login.keychain-db
515
+ ```
516
+ - **本地终端**:打开 **钥匙串访问** → 搜索 **"\<浏览器\> Safe Storage"** → **访问控制** → 添加你的终端 app → **保存更改**。
517
+ - 或在弹出 Keychain 授权时点击 **"始终允许"**。
461
518
  - 报错 `Twitter API error 404`:通常是 queryId 轮换,重试即可。
519
+
520
+ **诊断命令**:运行 `twitter doctor` 可输出完整诊断报告(版本、OS、浏览器检测、Keychain 状态、cookie 提取结果),方便提交 bug report。
521
+
462
522
  - 结构化错误码通常会区分 `not_authenticated`、`not_found`、`invalid_input`、`rate_limited`、`api_error`。
463
523
 
464
524
  ### 使用建议(防封号)
@@ -470,6 +530,13 @@ score = likes_w * likes
470
530
  - **避免数据中心 IP** — 住宅代理更安全
471
531
  - Cookie 仅在本地使用,不会被本工具上传
472
532
 
533
+ ### 输出模式建议
534
+
535
+ - 默认 rich table 适合终端交互式浏览
536
+ - 需要在表格里看完整正文时,使用 `--full-text`
537
+ - 需要脚本消费时,优先使用 `--yaml` 或 `--json`
538
+ - 需要节省 token 时,使用 `-c` / `--compact`
539
+
473
540
  ### 作为 AI Agent Skill 使用
474
541
 
475
542
  twitter-cli 提供了 [`SKILL.md`](./SKILL.md),可让 AI Agent 更稳定地调用本工具。
@@ -25,10 +25,24 @@ error:
25
25
  - `--yaml` and `--json` both use this envelope
26
26
  - non-TTY stdout defaults to YAML
27
27
  - tweet and user lists are returned under `data`
28
+ - `article` returns a single tweet object under `data`
28
29
  - `status` returns `data.authenticated` plus `data.user`
29
30
  - `whoami` returns `data.user`
30
31
  - write commands also support explicit `--json` / `--yaml`
31
32
 
33
+ ## Article Fields
34
+
35
+ `twitter article <id> --json` returns the standard tweet object plus:
36
+
37
+ ```yaml
38
+ data:
39
+ id: "1234567890"
40
+ articleTitle: "Article Title"
41
+ articleText: |
42
+ # Heading
43
+ Body text...
44
+ ```
45
+
32
46
  ## Error Codes
33
47
 
34
48
  Common structured error codes:
@@ -114,6 +114,19 @@ twitter feed --json | jq '.[0].text'
114
114
  All machine-readable output uses the envelope documented in [SCHEMA.md](./SCHEMA.md).
115
115
  Tweet and user payloads now live under `.data`.
116
116
 
117
+ ### Full text: `--full-text` flag (rich tables only)
118
+
119
+ Use `--full-text` when the user wants complete post bodies in terminal tables.
120
+ It affects rich table list views such as `feed`, `bookmarks`, `search`, `user-posts`, `likes`, `list`, and reply tables in `tweet`.
121
+ It does **not** change `--json`, `--yaml`, or `-c` compact output.
122
+
123
+ ```bash
124
+ twitter feed --full-text
125
+ twitter search "AI agent" --full-text
126
+ twitter user-posts elonmusk --max 20 --full-text
127
+ twitter tweet 1234567890 --full-text
128
+ ```
129
+
117
130
  ### Compact: `-c` flag (minimal tokens for LLM)
118
131
 
119
132
  ```bash
@@ -138,19 +151,26 @@ twitter user elonmusk --json # JSON output
138
151
  twitter feed # Home timeline (For You)
139
152
  twitter feed -t following # Following timeline
140
153
  twitter feed --max 50 # Limit count
154
+ twitter feed --full-text # Show full post body in table
141
155
  twitter feed --filter # Enable ranking filter
142
156
  twitter feed --yaml > tweets.yaml # Export as YAML
143
157
  twitter feed --input tweets.json # Read from local JSON file
144
158
  twitter bookmarks # Bookmarked tweets
159
+ twitter bookmarks --full-text # Full text in bookmarks table
145
160
  twitter bookmarks --max 30 --yaml
146
161
  twitter search "keyword" # Search tweets
147
162
  twitter search "AI agent" -t Latest --max 50
163
+ twitter search "AI agent" --full-text # Full text in search results
148
164
  twitter search "topic" -o results.json # Save to file
149
165
  twitter tweet 1234567890 # Tweet detail + replies
166
+ twitter tweet 1234567890 --full-text # Full text in reply table
150
167
  twitter tweet https://x.com/user/status/12345 # Accepts URL
151
168
  twitter list 1539453138322673664 # List timeline
169
+ twitter list 1539453138322673664 --full-text
152
170
  twitter user-posts elonmusk --max 20 # User's tweets
171
+ twitter user-posts elonmusk --full-text
153
172
  twitter likes elonmusk --max 30 # User's likes (own only, see note)
173
+ twitter likes elonmusk --full-text
154
174
  twitter followers elonmusk --max 50 # Followers
155
175
  twitter following elonmusk --max 50 # Following
156
176
  ```
@@ -241,6 +261,10 @@ twitter followers "$MY_NAME" --max 200 --json | jq -r '.data[].username' | grep
241
261
  twitter -c feed -t following --max 30
242
262
  twitter -c bookmarks --max 20
243
263
 
264
+ # Rich table with complete post bodies
265
+ twitter feed -t following --max 20 --full-text
266
+ twitter search "AI agent" --max 20 --full-text
267
+
244
268
  # Full JSON for analysis
245
269
  twitter feed -t following --max 30 -o following.json
246
270
  twitter bookmarks --max 20 -o bookmarks.json
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "twitter-cli"
7
- version = "0.6.3"
7
+ version = "0.6.6"
8
8
  description = "A CLI for Twitter/X — feed, bookmarks, and user timeline in terminal"
9
9
  readme = "README.md"
10
10
  license = "Apache-2.0"
@@ -36,6 +36,8 @@ def tweet_factory():
36
36
  retweeted_by=overrides.pop("retweeted_by", None),
37
37
  quoted_tweet=overrides.pop("quoted_tweet", None),
38
38
  score=overrides.pop("score", 0.0),
39
+ article_title=overrides.pop("article_title", None),
40
+ article_text=overrides.pop("article_text", None),
39
41
  )
40
42
 
41
43
  return _make_tweet