show error message if no articles were returned from feedparser

This commit is contained in:
Denis Lehmann 2020-04-19 16:04:22 +02:00
parent d37148ea32
commit 7d4d1311bb

View file

@ -56,6 +56,7 @@ Utility functions
# Get articles of a feed
def get_articles(feed):
feed = feedparser.parse(feed['url'])
return feed.entries
@ -217,6 +218,9 @@ def update_feed(feed):
articles = get_articles(feed)
threshold_date = datetime.now() - timedelta(days = max_age)
if len(articles) == 0:
error('no articles received from feed "{}"'.format(feed['name']))
for a in articles:
try:
@ -302,7 +306,7 @@ def initialize():
os.makedirs(lovedpath)
# Update all feeds and delete old messages
# Update all feeds and remove old articles
def crawl():
log('crawling feeds', True)