From 4efacb7e50e7b548469b2a543ff6e878528dec29 Mon Sep 17 00:00:00 2001 From: Roboron3042 Date: Sat, 23 Sep 2023 10:43:21 +0200 Subject: [PATCH] FIX: efemeridesbot error handling --- efemeridesbot.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/efemeridesbot.py b/efemeridesbot.py index f2d5bd5..02f970a 100644 --- a/efemeridesbot.py +++ b/efemeridesbot.py @@ -22,11 +22,14 @@ texts = {i: [] for i in years } for event in events: text = event.get_text() - text_year = int(text.split(":")[0].split(u'\xa0')[0].split(" ")[0].split(",")[0]) - for year in years: - if text_year < year: - texts[year].append(text) - break + try: + text_year = int(text.split(":")[0].split(u'\xa0')[0].split(" ")[0].split(",")[0]) + for year in years: + if text_year < year: + texts[year].append(text) + break + except: + print("Error: " + text) api = get_api('masto.es', 'efemeridesbot') last_id = 0