From 42de1efed1a111226322c5f7557d39c7f6970898 Mon Sep 17 00:00:00 2001 From: mitsuha_s Date: Sun, 12 Jun 2022 22:52:16 +0000 Subject: [PATCH] add a date display in update sent to the user --- rss.py | 5 ++++- telegram.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/rss.py b/rss.py index 1f6422b..0587255 100644 --- a/rss.py +++ b/rss.py @@ -6,7 +6,10 @@ class FeedItem: self.url = item.get('link', '') self.title = item.get('title', '') self.description = item.get('summary', '') - self.date = item.get('published', '') + if 'published' in item: + self.date = item.published_parsed() + else: + self.date = '' class Feed: def __init__(self, url: str, feed: FeedParserDict) -> None: diff --git a/telegram.py b/telegram.py index fb87c38..e147b24 100644 --- a/telegram.py +++ b/telegram.py @@ -123,7 +123,8 @@ class Notifier: def __format_message(item: FeedItem) -> str: return ( f"{item.title}\n\n" - f"{item.description}" + f"{item.description}\n" + f"{item.date}" )