From dd16696103f059376860ddd81424289d9f84d968 Mon Sep 17 00:00:00 2001 From: Andros Fenollosa Date: Thu, 6 Jul 2023 12:40:23 +0200 Subject: [PATCH] Add var config max entries Use `max_entries` as YAML key. Co-authored-by: Dom Rodriguez --- README.md | 3 ++- config.yml | 3 ++- rssingle.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 934007a..3930f05 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ title: My RSS Feed description: My customised RSS feed with technology news url: https://www.example.com output: rss.xml +max_entries: 5 # Delete this line to get all feeds: - https://programadorwebvalencia.com/feed/ - https://republicaweb.es/feed/ @@ -49,7 +50,7 @@ curl -o config.yml https://raw.githubusercontent.com/tanrax/RSSingle/master/conf 4. Run the binary. ``` shell -./rssingle +./rssingle ``` A file called `rss.xml` will be created. diff --git a/config.yml b/config.yml index 3d1af89..178ca14 100644 --- a/config.yml +++ b/config.yml @@ -2,6 +2,7 @@ title: My RSS Feed description: My customised RSS feed with technology news url: https://www.example.com output: rss.xml +max_entries: 2 # Delete this line to get all feeds: - https://programadorwebvalencia.com/feed/ - - https://republicaweb.es/feed/ \ No newline at end of file + - https://republicaweb.es/feed/ diff --git a/rssingle.py b/rssingle.py index 9fe9357..4baf136 100755 --- a/rssingle.py +++ b/rssingle.py @@ -97,7 +97,7 @@ def main(): rss = parse_rss_feed(feed) entries = rss.get("entries") log.debug("Iterating over [input] feed entries..") - for entry in entries: + for entry in entries[:CONFIG["max_entries"]] if "max_entries" in CONFIG else entries: log.debug("New feed entry created.") fe = fg.add_entry()