Skip to content

Commit

Permalink
Merge pull request #159 from MerleLiuKun/feat-note-tweet
Browse files Browse the repository at this point in the history
feat(model): ✨ add new fields from twitter tweet
  • Loading branch information
MerleLiuKun authored Mar 13, 2024
2 parents 612d8fc + 6618f90 commit 2b6ae3b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pytwitter/models/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class MediaOrganicMetrics(MediaNonPublicMetrics):


@dataclass
class MediaPromotedMetrics(MediaOrganicMetrics): ...
class MediaPromotedMetrics(MediaOrganicMetrics):
pass


@dataclass
Expand Down
15 changes: 13 additions & 2 deletions pytwitter/models/tweet.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ class TweetEntitiesHashtag(BaseModel):


@dataclass
class TweetEntitiesCashtag(TweetEntitiesHashtag): ...
class TweetEntitiesCashtag(TweetEntitiesHashtag):
pass


@dataclass
Expand Down Expand Up @@ -130,7 +131,8 @@ class TweetOrganicMetrics(TweetNonPublicMetrics):


@dataclass
class TweetPromotedMetrics(TweetOrganicMetrics): ...
class TweetPromotedMetrics(TweetOrganicMetrics):
pass


@dataclass
Expand Down Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion pytwitter/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class UserEntitiesHashtag(BaseModel):


@dataclass
class UserEntitiesMention(UserEntitiesHashtag): ...
class UserEntitiesMention(UserEntitiesHashtag):
pass


@dataclass
Expand Down

0 comments on commit 2b6ae3b

Please sign in to comment.