fix: Stray HTML tag is no longer in the API response?

This commit is contained in:
polyfloyd 2023-04-11 19:02:12 +02:00
parent c105428ec5
commit 6b857f1675

View file

@ -13,9 +13,7 @@ OFFSET = -time.timezone
events_url = "https://bitlair.nl/Special:Ask/-5B-5BCategory:Event-5D-5D-20-5B-5BStart::%E2%89%A519-20January-202023-5D-5D/-3FStart/-3FEnd/-3FEvent-20location/mainlabel%3D/limit%3D50/order%3DASC/sort%3DStart/prettyprint%3Dtrue/format%3Djson"
# above URL asks for all events and returns their name, start, end and location
events_page = requests.get(events_url)
# remove first line from output because the first line is '<script src='/vendor/composer/installed.js'></script>'
# which is not valid JSON, believe it or not
events = json.loads(''.join(events_page.text.splitlines(keepends=True)[1:]))
events = events_page.json()
cal = icalendar.Calendar()