From 4f25c2dd3fdf8d7eec42faca03b4c14d868fbd9b Mon Sep 17 00:00:00 2001 From: mitsuha_s Date: Mon, 4 Jul 2022 18:38:23 +0000 Subject: [PATCH] minor fixes --- rss.py | 4 +++- telegram.py | 12 +++++++----- update.py | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/rss.py b/rss.py index 0587255..514bb8d 100644 --- a/rss.py +++ b/rss.py @@ -9,7 +9,8 @@ class FeedItem: if 'published' in item: self.date = item.published_parsed() else: - self.date = '' + self.date = None + class Feed: def __init__(self, url: str, feed: FeedParserDict) -> None: @@ -19,6 +20,7 @@ class Feed: for item in feed.entries: self.items.append(FeedItem(item)) + class RssReader: def get_feed(self, url: str) -> Feed: return Feed(url, parse(url)) diff --git a/telegram.py b/telegram.py index e147b24..e929497 100644 --- a/telegram.py +++ b/telegram.py @@ -58,8 +58,8 @@ class CommandProcessor: feeds = self.database.find_user_feeds(data['user_id']) feed_list = '' - for count, feed in enumerate(feeds, start=1): - feed_list += '* ' + str(count) + ': ' + feed['url'] + '\n' + for index, feed in enumerate(feeds, start=1): + feed_list += '* ' + str(index) + ': ' + f"{feed['title']} str: return ( f"{item.title}\n\n" - f"{item.description}\n" - f"{item.date}" + f"{item.date}\n" + f"{item.description}" ) diff --git a/update.py b/update.py index 0cc00d6..c2c3624 100644 --- a/update.py +++ b/update.py @@ -12,4 +12,4 @@ notifier = Notifier(token) rss_reader = RssReader() updater = UpdateManager(db, notifier, rss_reader) -updater.update() \ No newline at end of file +updater.update()