Skip to content

Commit

Permalink
Add url key to preview link
Browse files Browse the repository at this point in the history
  • Loading branch information
koval01 committed Dec 12, 2024
1 parent 99ca766 commit 11b35bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/telegram/models/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,14 @@ class PreviewLink(BaseModel):
Attributes:
title (Optional[str]): The title of the linked content, if available
url (HttpUrl): This URL of preview page
site_name (str): The name of the website or platform the link is from
description (Optional[ParsedAndRaw]): The description of the linked content,
containing both parsed text and raw HTML formats
thumb (HttpUrl): The URL of the preview thumbnail image
"""
title: Optional[str]
url: HttpUrl
site_name: str
description: Optional[ParsedAndRaw]
thumb: HttpUrl
Expand Down
1 change: 1 addition & 0 deletions app/telegram/parser/types/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def preview_link(buble: LexborNode) -> Union[dict, None]:

return {
"site_name": preview.css_first(".link_preview_site_name").text(strip=True),
"url": preview.attributes.get("href"),
"title": title.text(strip=True) if title else None,
"description": description,
"thumb": Utils.background_extr(
Expand Down

0 comments on commit 11b35bb

Please sign in to comment.