If only the Chicago CTA api was close to reliable... It's well known for the ghost buses and disappearing trains. However we wouldn't probably need to call Apis, just refreshing their website would work as it's similar to OP's (or Google maps or any other using the apis).
The best solution here would be to secretly implant a RPI zero with gps into every bus