Initial commit: twitter-cli v0.1.0

This commit is contained in:
jackwener
2026-03-04 17:56:42 +08:00
commit 16752c3115
14 changed files with 2133 additions and 0 deletions

52
twitter_cli/models.py Normal file
View File

@@ -0,0 +1,52 @@
"""Data models for twitter-cli.
Defines Tweet, Author, Metrics, and TweetMedia as simple dataclasses.
"""
from __future__ import annotations
from dataclasses import dataclass, field
from typing import List, Optional
@dataclass
class Author:
id: str
name: str
screen_name: str
profile_image_url: str = ""
verified: bool = False
@dataclass
class Metrics:
likes: int = 0
retweets: int = 0
replies: int = 0
quotes: int = 0
views: int = 0
bookmarks: int = 0
@dataclass
class TweetMedia:
type: str # "photo" | "video" | "animated_gif"
url: str
width: Optional[int] = None
height: Optional[int] = None
@dataclass
class Tweet:
id: str
text: str
author: Author
metrics: Metrics
created_at: str
media: List[TweetMedia] = field(default_factory=list)
urls: List[str] = field(default_factory=list)
is_retweet: bool = False
lang: str = ""
retweeted_by: Optional[str] = None
quoted_tweet: Optional[Tweet] = None
score: float = 0.0