From 398799de0c1826c3544eb6eec681fa48096932a0 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Fri, 1 Sep 2023 19:31:47 +0300 Subject: Refactor --- src/FeedSourcePlugin.py | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 src/FeedSourcePlugin.py (limited to 'src/FeedSourcePlugin.py') diff --git a/src/FeedSourcePlugin.py b/src/FeedSourcePlugin.py deleted file mode 100644 index e6e4366..0000000 --- a/src/FeedSourcePlugin.py +++ /dev/null @@ -1,28 +0,0 @@ -import feedparser # type: ignore -from typing import Any -from Item import Item -from PluginInterface import PluginInterface -from utils import get_param - - -class Plugin(PluginInterface): - def __init__(self, id: str, params: dict[str, Any]) -> None: - super().__init__(id, params) - self.feed_url: str = get_param("feed_url", params) - - print(f"[FeedSourcePlugin#{self.id}] initialized") - - def validate_input_n(self, n: int) -> bool: - return n == 0 - - def process(self, inputs: list[list[Item]]) -> list[Item]: - print(f"[FeedSourcePlugin#{self.id}] process called") - feed: Any = feedparser.parse(self.feed_url) # type: ignore - items: list[Item] = [] - for d in feed.entries: - items.append( - Item(title=d["title"], link=d["link"], description=d["description"]) - ) - - print(f"[FeedSourcePlugin#{self.id}] process returns items, n={len(items)}") - return items -- cgit v1.3