fahrrad wien events feed
Keeping up with cycling events in/around Vienna can be bothersome.
There's a bunch of events, but so far I couldn't find a combined shared calendar or rss/json feed. There's a facebook group, but I couldn't find a way to get the events outside of facebook (and the dom looks like a mess).
So I made a custom feed for myself. It's available at this link to the json feed.
Sources
I found a couple sites with events. If I find more, I'll add them as well.
Implementation
It's a deno script, that returns a json feed.
The script loads the first page of the sources, finds the events in the dom, and adds them to the list of feed items. Each item has the event page's url as its id.
All sites are different, and have different implementations, but finding the relevant data was quick with a few querySelectorAll
thanks to deno dom.
For almost all sources, it just loads just one page (for Fahrrad Wien it also loads a second page, to get the events for the following month). This hopefully shouldn't put stress on the servers. The links also always point back to the event pages there.
If there's nice dom available for the event on the main page, then it gets put in the body of the feed items. Worst case it's just the link with a title.
I used json feed, since I didn't want to bother with xml, and it seems to be well supported in rss readers now. It's also really easy to generate, especially if you're doing it with typescript :D
Possible improvements
Caching data
Right now, the script always fetches the pages, extracts the data, and returns the feed.
This could be improved by fetching the pages with a cron job and putting the data into some kinda database. This could then also generate a json file, that can be served statically.
Getting more structured data
The most obvious improvement would be getting more info on the events, and putting them in a common format.
But that would probably mean loading each events page (therefore putting more strain on the pages, and running for longer). And doing more involved extraction of the data from the dom.
Some pages also have no structured data, so it would likely need some natural language processing, which I'd rather skip for this project.
For now I think just getting the links to events is enough. I'll click the link, and add it to my calendar by hand.
Generating calendar event files for the feed items
Create an .ics file for each event, and add it to the feed item's body. This would be really nice, but would require getting more structed data, as listed before. So this seems out of scope.
Shared calendar
The alternative would be creating a shared calendar, but this again needs more data to automate. Adding entries by hand is something I'd rather not do, especially if it's just for myself.