add get_feed method

This commit is contained in:
mitsuha_s 2022-05-29 20:25:07 +00:00
parent 7e96992c7f
commit 1dd2ccfc6e

9
rss.py
View file

@ -5,8 +5,7 @@ class FeedItem():
pass pass
class Feed(): class Feed():
def __init__(self, title: str, url: str, items: list) -> None: def __init__(self, url: str, items: list) -> None:
self.title = title
self.url = url self.url = url
self.items = items self.items = items
@ -18,6 +17,6 @@ class RssReader():
pass pass
def get_feed(self, url: str) -> Feed: def get_feed(self, url: str) -> Feed:
pass f = feedparser.parse(url)
items = self.get_items(f.entries)
return Feed(url, items)