fix TypeError with empty title, desc, pub_date rssItems
This commit is contained in:
parent
1d78a05807
commit
85c5c96392
12
src/feed.py
12
src/feed.py
@ -51,13 +51,13 @@ class RSSItem:
|
||||
RSSItem
|
||||
"""
|
||||
|
||||
guid = entry.get('id', None) or entry.get("guid", None)
|
||||
link = entry.get('link', None)
|
||||
title = entry.get('title', None)
|
||||
description = entry.get('description', None)
|
||||
guid = entry.get('id', None) or entry.get("guid")
|
||||
link = entry.get('link', "")
|
||||
title = entry.get('title', "")
|
||||
description = entry.get('description', "")
|
||||
|
||||
pub_date = entry.get('published_parsed', None)
|
||||
pub_date = datetime(*pub_date[0:6], tzinfo=timezone.utc)
|
||||
pub_date = datetime(*pub_date[0:6] if pub_date else None, tzinfo=timezone.utc)
|
||||
|
||||
content_image_url = entry.get("media_content", [{}])[0].get("url")
|
||||
thumb_image_url = entry.get("media_thumbnail", [{}])[0].get("url")
|
||||
@ -128,6 +128,8 @@ class RSSItem:
|
||||
discord.Embed
|
||||
"""
|
||||
|
||||
log.debug("Creating embed of item: %s", self.guid)
|
||||
|
||||
# Replace HTML with Markdown, and shorten text.
|
||||
title = shorten(markdownify(self.title, strip=["img", "a"]), 256)
|
||||
desc = shorten(markdownify(self.description, strip=["img"]), 4096)
|
||||
|
Loading…
x
Reference in New Issue
Block a user