Fix t#187 and change cache time limit

This commit is contained in:
pluja 2021-02-01 10:28:05 +01:00
parent e08d8ade7a
commit 46faa07273
2 changed files with 8 additions and 9 deletions

View File

@ -97,8 +97,8 @@ def twitter(page=0):
else: else:
time_diff = 999 time_diff = 999
# If cache file is more than 1 minute old # If cache file is older than 30 minute old
if page == 0 and time_diff > 60: if page == 0 and time_diff > 30:
if cache_file: if cache_file:
for f in cache_file: for f in cache_file:
os.remove(f) os.remove(f)

View File

@ -39,11 +39,10 @@ def get_feed(usernames, daysMaxOld=10, includeRT=True):
userFeed.append(tweet) userFeed.append(tweet)
else: else:
userFeed+=feed userFeed+=feed
try:
for uf in userFeed: for uf in userFeed:
if uf == 'emptyFeed': if uf == 'emptyFeed':
userFeed.remove(uf) userFeed.remove(uf)
userFeed.sort(key=lambda item:item['timeStamp'], reverse=True) userFeed.sort(key=lambda item:item['timeStamp'], reverse=True)
except:
return userFeed
return userFeed return userFeed