Init commit: get all the shows happening today
This commit is contained in:
parent
74003af96e
commit
90b14d1a10
|
@ -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))
|
Loading…
Reference in New Issue