Skip to content

Commit

Permalink
prioritize "content" tag over "description"
Browse files Browse the repository at this point in the history
  • Loading branch information
adbenitez committed Oct 16, 2024
1 parent ee49f86 commit 86c7774
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions feedsbot/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 86c7774

Please sign in to comment.