Merge pull request #16 from tanrax/add-limit-entries

Add limit entries
This commit is contained in:
Andros Fenollosa 2023-10-26 14:53:37 +02:00 committed by GitHub
commit f7a2c2417e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View File

@ -35,6 +35,7 @@ title: My RSS Feed
description: My customised RSS feed with technology news description: My customised RSS feed with technology news
url: https://www.example.com url: https://www.example.com
output: rss.xml output: rss.xml
max_entries: 5 # Delete this line to get all
feeds: feeds:
- https://programadorwebvalencia.com/feed/ - https://programadorwebvalencia.com/feed/
- https://republicaweb.es/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. 4. Run the binary.
``` shell ``` shell
./rssingle ./rssingle
``` ```
A file called `rss.xml` will be created. A file called `rss.xml` will be created.

View File

@ -2,6 +2,7 @@ title: My RSS Feed
description: My customised RSS feed with technology news description: My customised RSS feed with technology news
url: https://www.example.com url: https://www.example.com
output: rss.xml output: rss.xml
max_entries: 2 # Delete this line to get all
feeds: feeds:
- https://programadorwebvalencia.com/feed/ - https://programadorwebvalencia.com/feed/
- https://republicaweb.es/feed/ - https://republicaweb.es/feed/

View File

@ -96,8 +96,8 @@ def main():
for feed in CONFIG["feeds"]: for feed in CONFIG["feeds"]:
rss = parse_rss_feed(feed) rss = parse_rss_feed(feed)
entries = rss.get("entries") entries = rss.get("entries")
log.debug(f"Iterating over {feed} feed 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.") log.debug("New feed entry created.")
fe = fg.add_entry() fe = fg.add_entry()