From 3b78b1933048ac583d15a649437fc3d1000b3d2c Mon Sep 17 00:00:00 2001 From: lub Date: Thu, 20 Oct 2022 01:20:16 +0200 Subject: [PATCH] use extra variable instead of post['category'] directly --- scrape.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scrape.py b/scrape.py index 1480762..ebbfb96 100644 --- a/scrape.py +++ b/scrape.py @@ -152,8 +152,9 @@ async def main(): # scrape all blog posts and process them blog = get_blog() for post in blog: + category = post['category'] # check if post url is in cache and matches our category - if post['category'] in category_list and post['url'] not in cache[post['category']]: + if category in category_list and post['url'] not in cache[category]: # post url not found in cache # announce new post to matrix rooms print('new post: '+post['url']) @@ -173,7 +174,7 @@ async def main(): content=content) # add url to cache - cache[post['category']] += [post['url']] + cache[category] += [post['url']] else: # no new posts found