From 5b1e9231a4dc4b387280f4ea35d60c7b606bfc02 Mon Sep 17 00:00:00 2001 From: edwinbernadus Date: Thu, 7 May 2026 22:46:12 +0700 Subject: [PATCH] feat: implement author total followers --- twitter_cli/models.py | 2 ++ twitter_cli/parser.py | 2 ++ twitter_cli/serialization.py | 2 ++ 3 files changed, 6 insertions(+) diff --git a/twitter_cli/models.py b/twitter_cli/models.py index ee1d314..818f09e 100644 --- a/twitter_cli/models.py +++ b/twitter_cli/models.py @@ -16,6 +16,8 @@ class Author: screen_name: str profile_image_url: str = "" verified: bool = False + followers_count: int = 0 + following_count: int = 0 @dataclass diff --git a/twitter_cli/parser.py b/twitter_cli/parser.py index 58378be..077c8bc 100644 --- a/twitter_cli/parser.py +++ b/twitter_cli/parser.py @@ -107,6 +107,8 @@ def _extract_author(user_data, user_legacy): or user_legacy.get("profile_image_url_https", "") ), verified=bool(user_data.get("is_blue_verified") or user_legacy.get("verified", False)), + followers_count=_parse_int(user_legacy.get("followers_count"), 0), + following_count=_parse_int(user_legacy.get("friends_count"), 0), ) diff --git a/twitter_cli/serialization.py b/twitter_cli/serialization.py index 25ceede..e42491f 100644 --- a/twitter_cli/serialization.py +++ b/twitter_cli/serialization.py @@ -20,6 +20,8 @@ def tweet_to_dict(tweet: Tweet) -> Dict[str, Any]: "screenName": tweet.author.screen_name, "profileImageUrl": tweet.author.profile_image_url, "verified": tweet.author.verified, + "followers": tweet.author.followers_count, + "following": tweet.author.following_count, }, "metrics": { "likes": tweet.metrics.likes,