From 86c7774bcb0db6a294e156a48d29c8f4b076d119 Mon Sep 17 00:00:00 2001 From: adbenitez Date: Wed, 16 Oct 2024 19:22:37 +0200 Subject: [PATCH] prioritize "content" tag over "description" --- feedsbot/util.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/feedsbot/util.py b/feedsbot/util.py index cf51ea1..16f021b 100644 --- a/feedsbot/util.py +++ b/feedsbot/util.py @@ -149,11 +149,13 @@ def format_entries(entries: list, filter_: str) -> str: def _parse_entry(entry) -> tuple: title = entry.get("title") or "" pub_date = entry.get("published") or "" - desc = entry.get("description") or "" - if not desc and entry.get("content"): + desc = "" + if entry.get("content"): for c in entry.get("content"): if c.get("type") == "text/html": desc += c["value"] + if not desc: + desc = entry.get("description") or "" if title: desc_soup = bs4.BeautifulSoup(desc, "html5lib")