From ece6e42b68564476218b44c63ffa8fba35f78405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Helle=C5=9Ben?= Date: Wed, 18 Mar 2026 05:35:09 +0100 Subject: [PATCH] Refactor post_embed function and simplify first_image extraction logic --- discord_rss_bot/main.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/discord_rss_bot/main.py b/discord_rss_bot/main.py index 4359f1c..1e5211b 100644 --- a/discord_rss_bot/main.py +++ b/discord_rss_bot/main.py @@ -620,7 +620,7 @@ async def get_embed_page( @app.post("/embed", response_class=HTMLResponse) -async def post_embed( +async def post_embed( # noqa: C901 feed_url: Annotated[str, Form()], reader: Annotated[Reader, Depends(get_reader_dependency)], title: Annotated[str, Form()] = "", @@ -1060,9 +1060,7 @@ def create_html_for_feed( # noqa: C901, PLR0914 for content_item in entry.content: content: str = content_item.value - first_image, _ = get_first_image(summary, content) - - logging.getLogger("discord_rss_bot.main").info(f"main.py: entry_id={entry.id}, first_image={first_image}") + first_image = get_first_image(summary, content) text: str = replace_tags_in_text_message(entry, reader=reader) or ( "
No content available.
"