From 84982fc5b3ee031b4b5a8ae9e8ac282d96238276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 9 Nov 2020 13:05:34 +0100 Subject: [PATCH] Add support for string filtering of articles This allows me to only add articles where title contain certain string. --- main.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.py b/main.py index fc7dd3e..aad536d 100644 --- a/main.py +++ b/main.py @@ -46,6 +46,7 @@ class Site: github: bool tags: List[str] latest_article: Optional[str] + filter: Optional[str] def load_sites() -> Dict[str, Site]: @@ -57,6 +58,8 @@ def load_sites() -> Dict[str, Site]: entry["latest_article"] = None if "github" not in entry: entry["github"] = None + if "filter" not in entry: + entry["filter"] = None sites[title] = Site(title, **entry) return sites @@ -128,6 +131,9 @@ def handle_feed(api: WallabagAPI, site: Site, logger: logging.Logger, config: Co if article.title == site.latest_article: logger.debug("already added: " + article.title) break + if site.filter and not site.filter in article.title: + logger.debug("article filtered: " + article.title) + continue logger.info("article found: " + article.title) taglist = [site.title] if site.tags: