Code:
class DiRSSFeed(DiSkillV2):
def __init__(self):
super().__init__()
self.rss_feed: str = "url/feed"
def setRSSFeed(self, rssURL: str) -> DiRSSFeed:
self.rss_feed = rssURL
return self
def input(self, ear: str, skin: str, eye: str):
if ear == "rss test":
self.setVebatimAlgFromList(4, self.get_rss_titles(self.rss_feed))
@staticmethod
def get_rss_titles(rss_url) -> list[str]:
feed = feedparser.parse(rss_url)
titles = [entry.title for entry in feed.entries] # [:15]
return titles