From 46faa0727374d9ff8d1705c6dba0acb89347aa17 Mon Sep 17 00:00:00 2001 From: pluja Date: Mon, 1 Feb 2021 10:28:05 +0100 Subject: [PATCH] Fix t#187 and change cache time limit --- app/routes.py | 4 ++-- nitter/feed.py | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/routes.py b/app/routes.py index a54b9c6..c8075ce 100644 --- a/app/routes.py +++ b/app/routes.py @@ -97,8 +97,8 @@ def twitter(page=0): else: time_diff = 999 - # If cache file is more than 1 minute old - if page == 0 and time_diff > 60: + # If cache file is older than 30 minute old + if page == 0 and time_diff > 30: if cache_file: for f in cache_file: os.remove(f) diff --git a/nitter/feed.py b/nitter/feed.py index 05f820b..6ff5fd3 100644 --- a/nitter/feed.py +++ b/nitter/feed.py @@ -39,11 +39,10 @@ def get_feed(usernames, daysMaxOld=10, includeRT=True): userFeed.append(tweet) else: userFeed+=feed - try: - for uf in userFeed: - if uf == 'emptyFeed': - userFeed.remove(uf) - userFeed.sort(key=lambda item:item['timeStamp'], reverse=True) - except: - return userFeed + + for uf in userFeed: + if uf == 'emptyFeed': + userFeed.remove(uf) + userFeed.sort(key=lambda item:item['timeStamp'], reverse=True) + return userFeed \ No newline at end of file