import feedparser class FeedItem: def __init__(self, item: feedparser.util.FeedParserDict) -> None: self.url = item.get('link', '') self.title = item.get('title', '') self.description = item.get('summary', '') self.date = item.get('published', '') class Feed: def __init__(self, url: str, feed: feedparser.util.FeedParserDict) -> None: self.url = url self.items = self.__get_items(feed.entries) def __get_items(self, items: list[feedparser.util.FeedParserDict]) -> list[FeedItem]: list_items = [] for item in items: list_items.append(FeedItem(item)) return list_items class RssReader: def get_feed(self, url: str) -> Feed: return Feed(url, feedparser.parse(url))