Refactor post_embed function and simplify first_image extraction logic
All checks were successful
Test and build Docker image / docker (push) Successful in 22s

This commit is contained in:
Joakim Hellsén 2026-03-18 05:35:09 +01:00
commit ece6e42b68
Signed by: Joakim Hellsén
SSH key fingerprint: SHA256:/9h/CsExpFp+PRhsfA0xznFx2CGfTT5R/kpuFfUgEQk

View file

@ -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 (
"<div class='text-muted'>No content available.</div>"