From 2aa05468e023b9789b11d384822f9bc364d7b745 Mon Sep 17 00:00:00 2001 From: ikaroskun Date: Wed, 13 Mar 2024 15:04:04 +0800 Subject: [PATCH] feat(model): :sparkles: add new fields from twitter tweet --- pytwitter/models/media.py | 3 ++- pytwitter/models/tweet.py | 15 +++++++++++++-- pytwitter/models/user.py | 3 ++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/pytwitter/models/media.py b/pytwitter/models/media.py index 7aa10a3..83d3b56 100644 --- a/pytwitter/models/media.py +++ b/pytwitter/models/media.py @@ -25,7 +25,8 @@ class MediaOrganicMetrics(MediaNonPublicMetrics): @dataclass -class MediaPromotedMetrics(MediaOrganicMetrics): ... +class MediaPromotedMetrics(MediaOrganicMetrics): + ... @dataclass diff --git a/pytwitter/models/tweet.py b/pytwitter/models/tweet.py index cf1b740..a63677d 100644 --- a/pytwitter/models/tweet.py +++ b/pytwitter/models/tweet.py @@ -69,7 +69,8 @@ class TweetEntitiesHashtag(BaseModel): @dataclass -class TweetEntitiesCashtag(TweetEntitiesHashtag): ... +class TweetEntitiesCashtag(TweetEntitiesHashtag): + ... @dataclass @@ -130,7 +131,8 @@ class TweetOrganicMetrics(TweetNonPublicMetrics): @dataclass -class TweetPromotedMetrics(TweetOrganicMetrics): ... +class TweetPromotedMetrics(TweetOrganicMetrics): + ... @dataclass @@ -159,6 +161,12 @@ class TweetReferencedTweet(BaseModel): id: Optional[str] = field(default=None, repr=False, compare=False) +@dataclass +class TweetNoteTweet(BaseModel): + text: Optional[str] = field(default=None, repr=False, compare=False) + entities: Optional[TweetEntities] = field(default=None, repr=False, compare=False) + + @dataclass class Tweet(BaseModel): """ @@ -203,6 +211,9 @@ class Tweet(BaseModel): reply_settings: Optional[str] = field(default=None, repr=False, compare=False) source: Optional[str] = field(default=None, repr=False, compare=False) withheld: Optional[TweetWithheld] = field(default=None, repr=False, compare=False) + note_tweet: Optional[TweetNoteTweet] = field( + default=None, repr=False, compare=False + ) # Note: this field only for stream tweet matching_rules: Optional[List[StreamRule]] = field( diff --git a/pytwitter/models/user.py b/pytwitter/models/user.py index ebc452d..7fb6b5d 100644 --- a/pytwitter/models/user.py +++ b/pytwitter/models/user.py @@ -27,7 +27,8 @@ class UserEntitiesHashtag(BaseModel): @dataclass -class UserEntitiesMention(UserEntitiesHashtag): ... +class UserEntitiesMention(UserEntitiesHashtag): + ... @dataclass