twitter-cli 0.6.5__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.5 → twitter_cli-0.6.6}/PKG-INFO +15 -1
  2. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/README.md +14 -0
  3. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/SCHEMA.md +14 -0
  4. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/pyproject.toml +1 -1
  5. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/tests/conftest.py +2 -0
  6. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/tests/test_cli.py +100 -2
  7. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/tests/test_serialization.py +13 -0
  8. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/twitter_cli/cli.py +51 -1
  9. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/twitter_cli/client.py +39 -0
  10. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/twitter_cli/formatter.py +56 -0
  11. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/twitter_cli/graphql.py +1 -0
  12. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/uv.lock +1 -1
  13. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  14. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  15. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/.github/workflows/ci.yml +0 -0
  16. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/.github/workflows/publish-clawhub.yml +0 -0
  17. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/.github/workflows/publish.yml +0 -0
  18. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/.gitignore +0 -0
  19. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/LICENSE +0 -0
  20. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/SKILL.md +0 -0
  21. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/config.yaml +0 -0
  22. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/tests/fixtures/followers_page.json +0 -0
  23. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/tests/fixtures/home_timeline.json +0 -0
  24. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/tests/fixtures/list_timeline.json +0 -0
  25. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/tests/fixtures/search_timeline.json +0 -0
  26. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/tests/fixtures/tweet_detail.json +0 -0
  27. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/tests/test_auth.py +0 -0
  28. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/tests/test_client.py +0 -0
  29. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/tests/test_config.py +0 -0
  30. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/tests/test_config_normalization.py +0 -0
  31. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/tests/test_filter.py +0 -0
  32. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/tests/test_parser_fixtures.py +0 -0
  33. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/tests/test_smoke.py +0 -0
  34. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/twitter_cli/__init__.py +0 -0
  35. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/twitter_cli/auth.py +0 -0
  36. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/twitter_cli/config.py +0 -0
  37. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/twitter_cli/constants.py +0 -0
  38. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/twitter_cli/exceptions.py +0 -0
  39. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/twitter_cli/filter.py +0 -0
  40. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/twitter_cli/models.py +0 -0
  41. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/twitter_cli/output.py +0 -0
  42. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/twitter_cli/parser.py +0 -0
  43. {twitter_cli-0.6.5 → twitter_cli-0.6.6}/twitter_cli/serialization.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: twitter-cli
3
- Version: 0.6.5
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,6 +56,7 @@ 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
61
62
  - `--full-text`: disable tweet text truncation in rich table output
@@ -149,6 +150,12 @@ twitter tweet 1234567890
149
150
  twitter tweet 1234567890 --full-text
150
151
  twitter tweet https://x.com/user/status/1234567890
151
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
+
152
159
  # List timeline
153
160
  twitter list 1539453138322673664
154
161
  twitter list 1539453138322673664 --full-text
@@ -376,6 +383,7 @@ After installation, OpenClaw can call `twitter-cli` commands directly.
376
383
  - 收藏读取:查看账号书签推文
377
384
  - 搜索:按关键词搜索推文,支持 Top/Latest/Photos/Videos
378
385
  - 推文详情:查看推文及其回复
386
+ - 文章读取:获取 Twitter 长文,并导出为 Markdown
379
387
  - 列表时间线:获取 Twitter List 的推文
380
388
  - 用户查询:查看用户资料、推文、点赞、粉丝和关注
381
389
  - `--full-text`:在 rich table 输出里关闭推文正文截断
@@ -440,6 +448,12 @@ twitter search "trending" --filter # 启用排序筛选
440
448
  twitter tweet 1234567890
441
449
  twitter tweet 1234567890 --full-text
442
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
456
+
443
457
  # 列表时间线
444
458
  twitter list 1539453138322673664
445
459
  twitter list 1539453138322673664 --full-text
@@ -24,6 +24,7 @@ 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
29
30
  - `--full-text`: disable tweet text truncation in rich table output
@@ -117,6 +118,12 @@ twitter tweet 1234567890
117
118
  twitter tweet 1234567890 --full-text
118
119
  twitter tweet https://x.com/user/status/1234567890
119
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
+
120
127
  # List timeline
121
128
  twitter list 1539453138322673664
122
129
  twitter list 1539453138322673664 --full-text
@@ -344,6 +351,7 @@ After installation, OpenClaw can call `twitter-cli` commands directly.
344
351
  - 收藏读取:查看账号书签推文
345
352
  - 搜索:按关键词搜索推文,支持 Top/Latest/Photos/Videos
346
353
  - 推文详情:查看推文及其回复
354
+ - 文章读取:获取 Twitter 长文,并导出为 Markdown
347
355
  - 列表时间线:获取 Twitter List 的推文
348
356
  - 用户查询:查看用户资料、推文、点赞、粉丝和关注
349
357
  - `--full-text`:在 rich table 输出里关闭推文正文截断
@@ -408,6 +416,12 @@ twitter search "trending" --filter # 启用排序筛选
408
416
  twitter tweet 1234567890
409
417
  twitter tweet 1234567890 --full-text
410
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
424
+
411
425
  # 列表时间线
412
426
  twitter list 1539453138322673664
413
427
  twitter list 1539453138322673664 --full-text
@@ -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:
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "twitter-cli"
7
- version = "0.6.5"
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
@@ -6,8 +6,8 @@ from rich.console import Console
6
6
  import yaml
7
7
 
8
8
  from twitter_cli.cli import cli
9
- from twitter_cli.formatter import print_tweet_table
10
- from twitter_cli.models import UserProfile
9
+ from twitter_cli.formatter import article_to_markdown, print_tweet_table
10
+ from twitter_cli.models import Author, Metrics, Tweet, UserProfile
11
11
  from twitter_cli.serialization import tweets_to_json
12
12
 
13
13
 
@@ -125,6 +125,104 @@ def test_cli_tweet_accepts_shared_url_with_query(monkeypatch) -> None:
125
125
  assert result.exit_code == 0
126
126
 
127
127
 
128
+ def test_cli_article_accepts_article_url_and_json(monkeypatch) -> None:
129
+ class FakeClient:
130
+ def fetch_article(self, tweet_id: str) -> Tweet:
131
+ assert tweet_id == "12345"
132
+ return Tweet(
133
+ id="12345",
134
+ text="https://t.co/article",
135
+ author=Author(id="u1", name="Alice", screen_name="alice"),
136
+ metrics=Metrics(likes=1, retweets=2, replies=3, views=4, bookmarks=5),
137
+ created_at="2026-03-11",
138
+ article_title="Title",
139
+ article_text="Hello\n\n## Section",
140
+ )
141
+
142
+ monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: FakeClient())
143
+ monkeypatch.setattr(
144
+ "twitter_cli.cli.load_config",
145
+ lambda: {"fetch": {"count": 50}, "filter": {}, "rateLimit": {}},
146
+ )
147
+ runner = CliRunner()
148
+
149
+ result = runner.invoke(cli, ["article", "https://x.com/user/article/12345?s=20", "--json"])
150
+
151
+ assert result.exit_code == 0
152
+ payload = yaml.safe_load(result.output)
153
+ assert payload["ok"] is True
154
+ assert payload["data"]["id"] == "12345"
155
+ assert payload["data"]["articleTitle"] == "Title"
156
+ assert "Hello" in payload["data"]["articleText"]
157
+
158
+
159
+ def test_cli_article_markdown_output_and_save(monkeypatch, tmp_path) -> None:
160
+ article = Tweet(
161
+ id="12345",
162
+ text="https://t.co/article",
163
+ author=Author(id="u1", name="Alice", screen_name="alice"),
164
+ metrics=Metrics(likes=1, retweets=2, replies=3, views=4, bookmarks=5),
165
+ created_at="2026-03-11",
166
+ article_title="Title",
167
+ article_text="Hello\n\n## Section",
168
+ )
169
+
170
+ class FakeClient:
171
+ def fetch_article(self, tweet_id: str) -> Tweet:
172
+ assert tweet_id == "12345"
173
+ return article
174
+
175
+ monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: FakeClient())
176
+ monkeypatch.setattr("twitter_cli.cli.load_config", lambda: {})
177
+ output_path = tmp_path / "article.md"
178
+ runner = CliRunner()
179
+
180
+ result = runner.invoke(
181
+ cli,
182
+ ["article", "12345", "--markdown", "--output", str(output_path)],
183
+ )
184
+
185
+ assert result.exit_code == 0
186
+ assert result.output == article_to_markdown(article)
187
+ assert output_path.read_text(encoding="utf-8") == article_to_markdown(article)
188
+
189
+
190
+ def test_cli_article_markdown_overrides_auto_structured_output(monkeypatch) -> None:
191
+ article = Tweet(
192
+ id="12345",
193
+ text="https://t.co/article",
194
+ author=Author(id="u1", name="Alice", screen_name="alice"),
195
+ metrics=Metrics(likes=1, retweets=2, replies=3, views=4, bookmarks=5),
196
+ created_at="2026-03-11",
197
+ article_title="Title",
198
+ article_text="Hello\n\n## Section",
199
+ )
200
+
201
+ class FakeClient:
202
+ def fetch_article(self, tweet_id: str) -> Tweet:
203
+ assert tweet_id == "12345"
204
+ return article
205
+
206
+ monkeypatch.setenv("OUTPUT", "auto")
207
+ monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: FakeClient())
208
+ monkeypatch.setattr("twitter_cli.cli.load_config", lambda: {})
209
+ runner = CliRunner()
210
+
211
+ result = runner.invoke(cli, ["article", "12345", "--markdown"])
212
+
213
+ assert result.exit_code == 0
214
+ assert result.output == article_to_markdown(article)
215
+
216
+
217
+ def test_cli_article_rejects_compact_mode() -> None:
218
+ runner = CliRunner()
219
+
220
+ result = runner.invoke(cli, ["-c", "article", "12345"])
221
+
222
+ assert result.exit_code == 2
223
+ assert "does not support --compact" in result.output
224
+
225
+
128
226
  def test_cli_bookmark_alias_works(monkeypatch) -> None:
129
227
  calls = []
130
228
 
@@ -49,3 +49,16 @@ def test_compact_serialization(tweet_factory) -> None:
49
49
  assert len(parsed) == 1
50
50
  assert parsed[0]["author"] == "@alice"
51
51
 
52
+
53
+ def test_tweet_roundtrip_preserves_article_fields(tweet_factory) -> None:
54
+ tweet = tweet_factory(
55
+ "88",
56
+ article_title="Long-form title",
57
+ article_text="Intro\n\n## Details",
58
+ )
59
+
60
+ payload = tweet_to_dict(tweet)
61
+ restored = tweet_from_dict(payload)
62
+
63
+ assert restored.article_title == "Long-form title"
64
+ assert restored.article_text == "Intro\n\n## Details"
@@ -9,6 +9,7 @@ Read commands:
9
9
  twitter user-posts elonmusk # user tweets
10
10
  twitter likes elonmusk # user likes
11
11
  twitter tweet <id> # tweet detail + replies
12
+ twitter article <id> # Twitter Article as Markdown
12
13
  twitter list <id> # list timeline
13
14
  twitter followers <handle> # followers list
14
15
  twitter following <handle> # following list
@@ -46,7 +47,9 @@ from .client import TwitterClient
46
47
  from .config import load_config
47
48
  from .filter import filter_tweets
48
49
  from .formatter import (
50
+ article_to_markdown,
49
51
  print_filter_stats,
52
+ print_article,
50
53
  print_tweet_detail,
51
54
  print_tweet_table,
52
55
  print_user_profile,
@@ -63,6 +66,7 @@ from .output import (
63
66
  use_rich_output,
64
67
  )
65
68
  from .serialization import (
69
+ tweet_to_dict,
66
70
  tweets_from_json,
67
71
  tweets_to_data,
68
72
  tweets_to_compact_json,
@@ -214,7 +218,7 @@ def _normalize_tweet_id(value):
214
218
  candidate = raw
215
219
  if parsed.scheme and parsed.netloc:
216
220
  path = parsed.path.rstrip("/")
217
- match = re.search(r"/status/(\d+)$", path)
221
+ match = re.search(r"/(?:status|article)/(\d+)$", path)
218
222
  if not match:
219
223
  raise RuntimeError("Invalid tweet URL: %s" % value)
220
224
  candidate = match.group(1)
@@ -656,6 +660,52 @@ def tweet(ctx, tweet_id, max_count, full_text, as_json, as_yaml):
656
660
  console.print()
657
661
 
658
662
 
663
+ @cli.command()
664
+ @click.argument("tweet_id")
665
+ @structured_output_options
666
+ @click.option("--markdown", "-m", "as_markdown", is_flag=True, help="Output article as Markdown.")
667
+ @click.option("--output", "-o", "output_file", type=str, default=None, help="Save article Markdown to file.")
668
+ @click.pass_context
669
+ def article(ctx, tweet_id, as_json, as_yaml, as_markdown, output_file):
670
+ # type: (Any, str, bool, bool, bool, Optional[str]) -> None
671
+ """Fetch a Twitter Article. TWEET_ID is the numeric tweet ID or full URL."""
672
+ compact = ctx.obj.get("compact", False)
673
+ if compact:
674
+ raise click.UsageError("`twitter article` does not support --compact. Use --markdown or --output.")
675
+ if as_markdown and (as_json or as_yaml):
676
+ raise click.UsageError("Use only one of --markdown, --json, or --yaml.")
677
+
678
+ tweet_id = _normalize_tweet_id(tweet_id)
679
+ config = load_config()
680
+ rich_output = use_rich_output(as_json=as_json, as_yaml=as_yaml, compact=False) and not as_markdown
681
+ try:
682
+ client = _get_client_for_output(config, quiet=not rich_output)
683
+ if rich_output:
684
+ console.print("📰 Fetching article %s...\n" % tweet_id)
685
+ start = time.time()
686
+ article_tweet = client.fetch_article(tweet_id)
687
+ elapsed = time.time() - start
688
+ if rich_output:
689
+ console.print("✅ Fetched article in %.1fs\n" % elapsed)
690
+ except RuntimeError as exc:
691
+ _exit_with_error(exc)
692
+
693
+ markdown = article_to_markdown(article_tweet)
694
+ if output_file:
695
+ Path(output_file).write_text(markdown, encoding="utf-8")
696
+ if rich_output:
697
+ console.print("💾 Saved article Markdown to %s\n" % output_file)
698
+
699
+ if as_markdown:
700
+ click.echo(markdown, nl=False)
701
+ return
702
+ if emit_structured(tweet_to_dict(article_tweet), as_json=as_json, as_yaml=as_yaml):
703
+ return
704
+
705
+ print_article(article_tweet, console)
706
+ console.print()
707
+
708
+
659
709
  @cli.command(name="list")
660
710
  @click.argument("list_id")
661
711
  @click.option("--max", "-n", "max_count", type=int, default=None, help="Max tweets to fetch.")
@@ -321,6 +321,45 @@ class TwitterClient:
321
321
  },
322
322
  )
323
323
 
324
+ def fetch_article(self, tweet_id):
325
+ # type: (str) -> Tweet
326
+ """Fetch a Twitter Article by tweet ID."""
327
+ logger.debug("fetch_article: tweet_id=%s", tweet_id)
328
+
329
+ data = self._graphql_get(
330
+ "TweetResultByRestId",
331
+ variables={
332
+ "tweetId": tweet_id,
333
+ "withCommunity": False,
334
+ "includePromotedContent": False,
335
+ "withVoice": False,
336
+ },
337
+ features={
338
+ "longform_notetweets_consumption_enabled": True,
339
+ "responsive_web_twitter_article_tweet_consumption_enabled": True,
340
+ "longform_notetweets_rich_text_read_enabled": True,
341
+ "longform_notetweets_inline_media_enabled": True,
342
+ "articles_preview_enabled": True,
343
+ "responsive_web_graphql_exclude_directive_enabled": True,
344
+ "verified_phone_label_enabled": False,
345
+ },
346
+ field_toggles={
347
+ "withArticleRichContentState": True,
348
+ "withArticlePlainText": True,
349
+ },
350
+ )
351
+
352
+ result = _deep_get(data, "data", "tweetResult", "result")
353
+ if not result:
354
+ raise NotFoundError("Article not found: tweet_id=%s" % tweet_id)
355
+
356
+ tweet = parse_tweet_result(result)
357
+ if tweet is None or (tweet.article_title is None and tweet.article_text is None):
358
+ raise NotFoundError("Tweet %s has no article content" % tweet_id)
359
+
360
+ logger.info("fetch_article: tweet_id=%s", tweet_id)
361
+ return tweet
362
+
324
363
  def fetch_list_timeline(self, list_id, count=20):
325
364
  # type: (str, int) -> List[Tweet]
326
365
  """Fetch tweets from a Twitter List."""
@@ -5,6 +5,7 @@ from __future__ import annotations
5
5
  from typing import List, Optional
6
6
 
7
7
  from rich.console import Console
8
+ from rich.markdown import Markdown
8
9
  from rich.panel import Panel
9
10
  from rich.table import Table
10
11
 
@@ -150,6 +151,61 @@ def print_tweet_detail(tweet: Tweet, console: Optional[Console] = None) -> None:
150
151
  ))
151
152
 
152
153
 
154
+ def article_to_markdown(tweet: Tweet) -> str:
155
+ """Convert a Twitter Article tweet into a Markdown document."""
156
+ title = tweet.article_title or "Twitter Article"
157
+ lines = [
158
+ "# %s" % title,
159
+ "",
160
+ "- Author: @%s (%s)" % (tweet.author.screen_name, tweet.author.name),
161
+ "- Published: %s" % (tweet.created_at or "unknown"),
162
+ "- URL: https://x.com/%s/status/%s" % (tweet.author.screen_name, tweet.id),
163
+ "- Likes: %s" % format_number(tweet.metrics.likes),
164
+ "- Retweets: %s" % format_number(tweet.metrics.retweets),
165
+ "- Replies: %s" % format_number(tweet.metrics.replies),
166
+ "- Bookmarks: %s" % format_number(tweet.metrics.bookmarks),
167
+ "- Views: %s" % format_number(tweet.metrics.views),
168
+ ]
169
+
170
+ if tweet.article_text:
171
+ lines.extend(["", tweet.article_text.strip()])
172
+
173
+ return "\n".join(lines).strip() + "\n"
174
+
175
+
176
+ def print_article(tweet: Tweet, console: Optional[Console] = None) -> None:
177
+ """Print a Twitter Article with rich formatting."""
178
+ if console is None:
179
+ console = Console()
180
+
181
+ verified = " ✓" if tweet.author.verified else ""
182
+ title = tweet.article_title or "Twitter Article"
183
+ meta_parts = [
184
+ "By @%s%s (%s)" % (tweet.author.screen_name, verified, tweet.author.name),
185
+ "🕐 %s" % tweet.created_at,
186
+ "🔗 x.com/%s/status/%s" % (tweet.author.screen_name, tweet.id),
187
+ "",
188
+ "❤️ %s 🔄 %s 💬 %s 🔖 %s 👁️ %s"
189
+ % (
190
+ format_number(tweet.metrics.likes),
191
+ format_number(tweet.metrics.retweets),
192
+ format_number(tweet.metrics.replies),
193
+ format_number(tweet.metrics.bookmarks),
194
+ format_number(tweet.metrics.views),
195
+ ),
196
+ ]
197
+ console.print(Panel(
198
+ "\n".join(meta_parts),
199
+ title="📰 %s" % title,
200
+ border_style="blue",
201
+ expand=True,
202
+ ))
203
+
204
+ if tweet.article_text:
205
+ console.print()
206
+ console.print(Markdown(tweet.article_text))
207
+
208
+
153
209
  def print_filter_stats(
154
210
  original_count: int,
155
211
  filtered: List[Tweet],
@@ -43,6 +43,7 @@ FALLBACK_QUERY_IDS = {
43
43
  "DeleteRetweet": "iQtK4dl5hBmXewYZuEOKVw",
44
44
  "CreateBookmark": "aoDbu3RHznuiSkQ9aNM67Q",
45
45
  "DeleteBookmark": "Wlmlj2-xISYCixDmuS8KNg",
46
+ "TweetResultByRestId": "7xflPyRiUxGVbJd4uWmbfg",
46
47
  }
47
48
 
48
49
  # ── Default feature flags ────────────────────────────────────────────────
@@ -1010,7 +1010,7 @@ wheels = [
1010
1010
 
1011
1011
  [[package]]
1012
1012
  name = "twitter-cli"
1013
- version = "0.6.5"
1013
+ version = "0.6.6"
1014
1014
  source = { editable = "." }
1015
1015
  dependencies = [
1016
1016
  { name = "beautifulsoup4" },
File without changes
File without changes
File without changes
File without changes