From c0c34f41a92c4846d98c429a8b176bcaaac08529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= Date: Sun, 2 Jun 2024 17:45:45 +0200 Subject: [PATCH] Remove HTML tags that break Discord markdown --- discord_rss_bot/custom_message.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/discord_rss_bot/custom_message.py b/discord_rss_bot/custom_message.py index bc98cec..5530f02 100644 --- a/discord_rss_bot/custom_message.py +++ b/discord_rss_bot/custom_message.py @@ -68,8 +68,8 @@ def replace_tags_in_text_message(entry: Entry) -> str: first_image: str = get_first_image(summary, content) - summary = markdownify(summary) - content = markdownify(content) + summary = markdownify(summary, strip=["img", "table", "td", "tr", "tbody", "thead"]) + content = markdownify(content, strip=["img", "table", "td", "tr", "tbody", "thead"]) list_of_replacements = [ {"{{feed_author}}": feed.author}, @@ -164,8 +164,8 @@ def replace_tags_in_embed(feed: Feed, entry: Entry) -> CustomEmbed: first_image: str = get_first_image(summary, content) - summary = markdownify(summary) - content = markdownify(content) + summary = markdownify(summary, strip=["img", "table", "td", "tr", "tbody", "thead"]) + content = markdownify(content, strip=["img", "table", "td", "tr", "tbody", "thead"]) feed_added: str = feed.added.strftime("%Y-%m-%d %H:%M:%S") if feed.added else "Never" feed_last_updated: str = feed.last_updated.strftime("%Y-%m-%d %H:%M:%S") if feed.last_updated else "Never"