twenty-four: gym service
My gym’s website takes reservations about three weeks out, popular classes fill quickly, and there’s no API. So part of twenty-four logs in and clicks the buttons for me.
It started as Python and Selenium with a Chrome sidecar. It’s now Go and chromedp, driving a shared Chrome in the cluster.
What it does
Every 15 minutes it scrapes the calendar and my bookings, then tries to reserve anything I’ve planned. If a class is full, it joins the waitlist. Each workout’s description says what the gym actually shows:
✅ Reserved — confirmed Nov 3
⏳ Waitlist 1 of 6 — confirmed Nov 3
Deleting a calendar event cancels the booking and removes the workout from Intervals.icu.
What broke
Every rule in the service came from a failure:
- The word “Cancel”: The class page has a “Cancel” link back to the calendar. The scraper took it for an existing reservation and reported
already_reserved, while routine retried a full class 198 times in three days. - Waitlist cancels: These redirect to a page with no enrollment controls, so every one that worked was logged as a failure. Success now means reloading the enrollment page and finding no booking.
- Failed logins: The Calendar link renders when you’re logged out too, so waiting on it let a failed login continue anonymously. Now it waits for “Log Out”.
- One browser: A reserve or cancel takes about 70 seconds and there’s one Chrome, so callers queue. They used to fail fast and lost the race to the scraper every cycle.
- Failed cancels: These used to delete the workout anyway. The next sync recreated it from the live reservation, and auto-reserve would then rejoin a waitlist I’d left. Now a failed cancel keeps the workout and retries.
- Partial scrapes: An incomplete scrape looked like missing bookings and set off new reservation attempts. Now it fails and keeps the previous data.
It also tracks the one personal training session my membership includes each week, and sends a notification if a week closes without one, since the missing-session form is how I get a make-up credit.
This post was written by Claude, guided & reviewed by Nick.