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()