From 98efd002284d6fb054cdb9a4292fda0616e88b86 Mon Sep 17 00:00:00 2001 From: Brendan Howell Date: Sun, 1 Oct 2017 11:06:05 +0200 Subject: [PATCH] RSS feeds now defined in YAML config file --- screenless/bureau/publications/publications.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/screenless/bureau/publications/publications.py b/screenless/bureau/publications/publications.py index 23e4c67..0c61565 100644 --- a/screenless/bureau/publications/publications.py +++ b/screenless/bureau/publications/publications.py @@ -167,18 +167,12 @@ class Publications(Bureau): def _get_news(self): """fetch a set of latest news entries from sources specified in config """ + feeds = self.config["newsfeeds"] entries = [] - # TODO: come up with a good way to make this configurable - feeds = [("http://feeds.bbci.co.uk/news/world/rss.xml", 10), - ("http://rss.liberation.fr/rss/latest/", 10), - ("http://feeds.arstechnica.com/arstechnica/index/", 10), - ("http://feeds.feedburner.com/zerohedge/feed", 5), - ("http://planet.python.org/rss20.xml", 5)] - for source in feeds: - url = source[0] - num_entries = source[1] + url = source["url"] + num_entries = source["count"] # get feed data with requests using a timeout try: