From 90b14d1a10a96e2c97f1bd0298e42e412a2f9261 Mon Sep 17 00:00:00 2001 From: Qumarth Jash Date: Fri, 31 May 2024 12:53:49 +0100 Subject: [PATCH] Init commit: get all the shows happening today --- main.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..c4e4127 --- /dev/null +++ b/main.py @@ -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))