From 64d8aecd94fae75bc24cd2f326d8ed45de554c6f Mon Sep 17 00:00:00 2001 From: Qumarth Jash Date: Fri, 31 May 2024 13:05:10 +0100 Subject: [PATCH] Extract ONLY talks today --- main.py | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index c4e4127..86ba7c9 100644 --- a/main.py +++ b/main.py @@ -7,17 +7,31 @@ def extract_day(datetime_str): dt = datetime.strptime(datetime_str.split()[0], "%Y-%m-%d") return(dt.date()) -all_talks = None +all_stuff = None with urllib.request.urlopen("https://www.emfcamp.org/schedule/2024.json") as url: - all_talks = json.load(url) + all_stuff = json.load(url) +# All things happening today today = datetime.today().date() -talks_today = [] -for talk in all_talks: - day = extract_day(talk["start_date"]) +all_today = [] +for thing in all_stuff: + day = extract_day(thing["start_date"]) if day == today: - talks_today.append(talk) + all_today.append(thing) + +# Only talks +all_talks = [] +for thing in all_today: + if thing["type"] == "talk": + all_talks.append(thing) + +# talks_not_private = [] +# for talk in talks_today: +# if talk["video_privacy"] != 'public': +# talks_not_private.append(talk) print(len(all_talks)) -print(len(talks_today)) +print(len(all_stuff)) +# print(len(talks_today)) +# print(len(talks_not_private))