video-privacy-today/main.py

38 lines
870 B
Python
Raw Normal View History

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