diff --git a/main.py b/main.py index 15a93f8..b3737b2 100644 --- a/main.py +++ b/main.py @@ -27,6 +27,7 @@ def crawl(): end=datetime.strptime((datetime.now() + timedelta(days=365)).strftime('%Y-%m-%d'), '%Y-%m-%d')) except ValueError as error: # Value error sometimes happens because of a problem with dateutil and timezones + print("error") exit(1) # ______ __ __ __ __ __ __ ____ _____ ____ __ @@ -81,17 +82,18 @@ def crawl(): # Also removes the timezone from all the datetime objects evtIdx = {} for event in events: + # Remove random last part of uid + uid = event.uid + if '_' in uid: + event.uid = uid[:(uid.rindex('_'))] + if not event.uid in evtIdx.keys(): # Event not known yet uid = event.uid - # Remove random last part of uid - uid = uid[:(uid.rindex('_'))] event.uid = uid + '---0' evtIdx[uid] = 1 else: uid = event.uid - # Remove random last part of uid - uid = uid[:(uid.rindex('_'))] event.uid = uid + '---' + str(evtIdx[uid]) evtIdx[uid] += 1 # Remove timezones