Skip to content

Commit

Permalink
fix url fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
captn3m0 committed Jan 14, 2025
1 parent bf7b2bd commit 171d95c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/event-fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,12 @@ def fix_online_schema(url, event):
event[x] = f"{event[x]}T{time}"

# fix format to ISO and timezone to IST
print(event)
for x in ["startDate", "endDate"]:
if x in event:
try:
event[x] = datetime.fromisoformat(event[x]).astimezone(IST).isoformat()
except Exception as e:
if get_domain(event['url']) == 'bhaagoindia.com':
if get_domain(url) == 'bhaagoindia.com':
# replace all dots and commas
startdate = event[x].replace(".", "").replace(",", "").lower()
startdate = startdate.replace("sept", "sep")
Expand All @@ -157,7 +156,7 @@ def fix_online_schema(url, event):
.isoformat()
)
# Allevents has some events with wrong formatting + timezone
if get_domain(event['url']) == 'allevents.in':
if get_domain(url) == 'allevents.in':
if event[x].endswith('+.000+0'):
event[x] = datetime.fromisoformat(event[x][0:19]).astimezone(IST).isoformat()
else:
Expand Down

0 comments on commit 171d95c

Please sign in to comment.