From d34732def7bf8d0be0adc2fa7bd63e57596ff88f Mon Sep 17 00:00:00 2001 From: aikaterna <20862007+aikaterna@users.noreply.github.com> Date: Sat, 16 Oct 2021 14:07:31 -0700 Subject: [PATCH] [RSS] Support specific "image" tag format If "image" is a dict and has an "href" tag inside, map it to $image_plaintext --- rss/rss.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rss/rss.py b/rss/rss.py index 44f7063..5db0f6a 100644 --- a/rss/rss.py +++ b/rss/rss.py @@ -29,7 +29,7 @@ IPV4_RE = re.compile("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}") IPV6_RE = re.compile("([a-f0-9:]+:+)+[a-f0-9]+") -__version__ = "1.6.1" +__version__ = "1.6.2" class RSS(commands.Cog): @@ -217,6 +217,13 @@ class RSS(commands.Cog): rss_object["is_special"].append("tags_list") rss_object["is_special"].append("tags_plaintext_list") + # if image dict tag exists, check for an image + try: + rss_object["image_plaintext"] = rss_object["image"]["href"] + rss_object["is_special"].append("image_plaintext") + except KeyError: + pass + # if media_thumbnail or media_content exists, return the first friendly url try: rss_object["media_content_plaintext"] = rss_object["media_content"][0]["url"]