Skip to content

Commit

Permalink
add links of tweets
Browse files Browse the repository at this point in the history
  • Loading branch information
osoken committed Aug 18, 2024
1 parent 64e1dfd commit a34b969
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/birdxplorer_api/routers/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ def get_posts(
search_text=search_text,
)

total_count = len(posts)
paginated_posts = posts[offset : offset + limit]
for post in paginated_posts:
post.link = f"https://x.com/{post.x_user.name}/status/{post.post_id}"

base_url = str(request.url).split("?")[0]
next_offset = offset + limit
prev_offset = max(offset - limit, 0)
Expand Down
1 change: 1 addition & 0 deletions common/birdxplorer_common/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,7 @@ class XUser(BaseModel):


class Post(BaseModel):
link: HttpUrl
post_id: PostId
x_user_id: UserId
x_user: XUser
Expand Down

0 comments on commit a34b969

Please sign in to comment.