Skip to content

Commit

Permalink
Update tweet.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ankh2054 authored Jan 11, 2025
1 parent dfd1e7c commit a1c6ec2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions twikit/guest/tweet.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,12 @@ def __init__(self, client: GuestClient, data: dict, user: User = None) -> None:
self.view_count_state: str = data['views'].get('state') if 'views' in data else None
self.has_community_notes: bool = data.get('has_birdwatch_notes')

# Get bookmark count from public_metrics if available, otherwise from legacy
# Get bookmark count from public_metrics if available, otherwise from legacy
public_metrics = data.get('public_metrics', {})
self.bookmark_count: int | None = (
public_metrics.get('bookmark_count') or
legacy.get('bookmark_count')
public_metrics.get('bookmark_count')
if public_metrics.get('bookmark_count') is not None
else legacy.get('bookmark_count')
)

if data.get('quoted_status_result'):
Expand Down

0 comments on commit a1c6ec2

Please sign in to comment.