Skip to content

Commit

Permalink
[Units] Improve coherence of search_wiki function
Browse files Browse the repository at this point in the history
  • Loading branch information
Harmon758 committed Jul 26, 2023
1 parent f73f045 commit c5d668a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions units/wikis.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,10 @@ async def search_wiki(

# TODO: Handle bold (''' -> **) and italics ('' -> *)

thumbnail = page.get("thumbnail")
if (thumbnail := page.get("thumbnail")):
thumbnail = thumbnail["source"].replace(
f"{thumbnail['width']}px", "1200px"
)

logo = wiki_info_data["logo"]
if logo.startswith("//"):
Expand All @@ -254,11 +257,7 @@ async def search_wiki(
title = page["title"],
url = page["fullurl"], # TODO: Use canonicalurl?
extract = extract,
image_url = (
thumbnail["source"].replace(
f"{thumbnail['width']}px", "1200px"
) if thumbnail else None
),
image_url = thumbnail,
wiki = wiki_info
)

0 comments on commit c5d668a

Please sign in to comment.