Extract ONLY talks today

This commit is contained in:
Qumarth Jash 2024-05-31 13:05:10 +01:00
parent 90b14d1a10
commit 64d8aecd94
1 changed files with 21 additions and 7 deletions

28
main.py
View File

@ -7,17 +7,31 @@ def extract_day(datetime_str):
dt = datetime.strptime(datetime_str.split()[0], "%Y-%m-%d") dt = datetime.strptime(datetime_str.split()[0], "%Y-%m-%d")
return(dt.date()) return(dt.date())
all_talks = None all_stuff = None
with urllib.request.urlopen("https://www.emfcamp.org/schedule/2024.json") as url: 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() today = datetime.today().date()
talks_today = [] all_today = []
for talk in all_talks: for thing in all_stuff:
day = extract_day(talk["start_date"]) day = extract_day(thing["start_date"])
if day == today: 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(all_talks))
print(len(talks_today)) print(len(all_stuff))
# print(len(talks_today))
# print(len(talks_not_private))