Refactor post_embed function and simplify first_image extraction logic
All checks were successful
Test and build Docker image / docker (push) Successful in 22s
All checks were successful
Test and build Docker image / docker (push) Successful in 22s
This commit is contained in:
parent
4836c2428b
commit
ece6e42b68
1 changed files with 2 additions and 4 deletions
|
|
@ -620,7 +620,7 @@ async def get_embed_page(
|
||||||
|
|
||||||
|
|
||||||
@app.post("/embed", response_class=HTMLResponse)
|
@app.post("/embed", response_class=HTMLResponse)
|
||||||
async def post_embed(
|
async def post_embed( # noqa: C901
|
||||||
feed_url: Annotated[str, Form()],
|
feed_url: Annotated[str, Form()],
|
||||||
reader: Annotated[Reader, Depends(get_reader_dependency)],
|
reader: Annotated[Reader, Depends(get_reader_dependency)],
|
||||||
title: Annotated[str, Form()] = "",
|
title: Annotated[str, Form()] = "",
|
||||||
|
|
@ -1060,9 +1060,7 @@ def create_html_for_feed( # noqa: C901, PLR0914
|
||||||
for content_item in entry.content:
|
for content_item in entry.content:
|
||||||
content: str = content_item.value
|
content: str = content_item.value
|
||||||
|
|
||||||
first_image, _ = get_first_image(summary, content)
|
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}")
|
|
||||||
|
|
||||||
text: str = replace_tags_in_text_message(entry, reader=reader) or (
|
text: str = replace_tags_in_text_message(entry, reader=reader) or (
|
||||||
"<div class='text-muted'>No content available.</div>"
|
"<div class='text-muted'>No content available.</div>"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue