[RSS] Support specific "image" tag format

If "image" is a dict and has an "href" tag inside, map it to $image_plaintext
This commit is contained in:
aikaterna
2021-10-16 14:07:31 -07:00
committed by GitHub
parent 9147d128af
commit d34732def7

View File

@@ -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"]