FIX: efemeridesbot error handling

This commit is contained in:
Roboron3042 2023-09-23 10:43:21 +02:00
parent 44e133ece8
commit 4efacb7e50
1 changed files with 8 additions and 5 deletions

View File

@ -22,11 +22,14 @@ texts = {i: [] for i in years }
for event in events: for event in events:
text = event.get_text() text = event.get_text()
text_year = int(text.split(":")[0].split(u'\xa0')[0].split(" ")[0].split(",")[0]) try:
for year in years: text_year = int(text.split(":")[0].split(u'\xa0')[0].split(" ")[0].split(",")[0])
if text_year < year: for year in years:
texts[year].append(text) if text_year < year:
break texts[year].append(text)
break
except:
print("Error: " + text)
api = get_api('masto.es', 'efemeridesbot') api = get_api('masto.es', 'efemeridesbot')
last_id = 0 last_id = 0