video-privacy-today/main.py

38 lines
870 B
Python

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_stuff = None
with urllib.request.urlopen("https://www.emfcamp.org/schedule/2024.json") as url:
all_stuff = json.load(url)
# All things happening today
today = datetime.today().date()
all_today = []
for thing in all_stuff:
day = extract_day(thing["start_date"])
if day == today:
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_stuff))
# print(len(talks_today))
# print(len(talks_not_private))