Init commit: get all the shows happening today

This commit is contained in:
Qumarth Jash 2024-05-31 12:53:49 +01:00
parent 74003af96e
commit 90b14d1a10
1 changed files with 23 additions and 0 deletions

23
main.py Normal file
View File

@ -0,0 +1,23 @@
from datetime import datetime
import urllib.request
import json
def extract_day(datetime_str):
dt = datetime.strptime(datetime_str.split()[0], "%Y-%m-%d")
return(dt.date())
all_talks = None
with urllib.request.urlopen("https://www.emfcamp.org/schedule/2024.json") as url:
all_talks = json.load(url)
today = datetime.today().date()
talks_today = []
for talk in all_talks:
day = extract_day(talk["start_date"])
if day == today:
talks_today.append(talk)
print(len(all_talks))
print(len(talks_today))