Remove [https:// from markdown link
This commit is contained in:
@ -71,6 +71,14 @@ def replace_tags_in_text_message(entry: Entry) -> str:
|
||||
summary = markdownify(summary, strip=["img", "table", "td", "tr", "tbody", "thead"])
|
||||
content = markdownify(content, strip=["img", "table", "td", "tr", "tbody", "thead"])
|
||||
|
||||
if "[https://" in content or "[https://www." in content:
|
||||
content = content.replace("[https://", "[")
|
||||
content = content.replace("[https://www.", "[")
|
||||
|
||||
if "[https://" in summary or "[https://www." in summary:
|
||||
summary = summary.replace("[https://", "[")
|
||||
summary = summary.replace("[https://www.", "[")
|
||||
|
||||
list_of_replacements = [
|
||||
{"{{feed_author}}": feed.author},
|
||||
{"{{feed_added}}": feed.added},
|
||||
@ -167,6 +175,14 @@ def replace_tags_in_embed(feed: Feed, entry: Entry) -> CustomEmbed:
|
||||
summary = markdownify(summary, strip=["img", "table", "td", "tr", "tbody", "thead"])
|
||||
content = markdownify(content, strip=["img", "table", "td", "tr", "tbody", "thead"])
|
||||
|
||||
if "[https://" in content or "[https://www." in content:
|
||||
content = content.replace("[https://", "[")
|
||||
content = content.replace("[https://www.", "[")
|
||||
|
||||
if "[https://" in summary or "[https://www." in summary:
|
||||
summary = summary.replace("[https://", "[")
|
||||
summary = summary.replace("[https://www.", "[")
|
||||
|
||||
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"
|
||||
feed_updated: str = feed.updated.strftime("%Y-%m-%d %H:%M:%S") if feed.updated else "Never"
|
||||
|
@ -41,7 +41,7 @@ def send_entry_to_discord(entry: Entry, custom_reader: Reader | None = None) ->
|
||||
# Try to get the custom message for the feed. If the user has none, we will use the default message.
|
||||
# This has to be a string for some reason so don't change it to "not custom_message.get_custom_message()"
|
||||
if custom_message.get_custom_message(reader, entry.feed) != "": # noqa: PLC1901
|
||||
webhook_message = custom_message.replace_tags_in_text_message(entry=entry)
|
||||
webhook_message: str = custom_message.replace_tags_in_text_message(entry=entry)
|
||||
|
||||
if not webhook_message:
|
||||
webhook_message = "No message found."
|
||||
|
Reference in New Issue
Block a user