Trying to read play by play information, only works some of the time.
Long story short I'm trying to do a project that lights up some LEDs every time there's a hit or a scoring play. I'm at the point using toddrob99's python wrapper that I can get when some type of play or putout occurs which is awesome... but it's not consistent.
I've tried upping the refresh rate to every 5 seconds but eventually I hit the API too much and I get timed out. For some reason when I refresh every 10 seconds it misses out on some hits that occur. I'm not sure if it has to do with how Spring Training gets data entered or what.
Has anyone tried to do a play by play program before? Any tips you can offer?
Posted Mar 17, 2025, 4:15 AM UTC
Using the websocket might be better here. It’s a bit hard to find up-to-date info on it, but this post helped me get started: https://www.reddit.com/r/mlbdata/s/26vruFtUjI
I think some of the info in there like the “Gameday5” thing might be a bit outdated, but it was enough info for me to establish a connection and print all the events in real time the other day.
The info you get is a bit barebones and might require some api calls to make full sense of/get additional context, but it does send a message for every score change I believe
Every little bit helps, I appreciate it!
No problem, I’m actually working on a similar project so feel free to shoot me any questions and I’ll share what little insight I might have. Good luck!
What is outdated about the "Gameday5"? Did they change it?
As far as I can tell it’s not needed anymore. The server doesn’t send it and neither do you need to to connect
That makes sense. Thanks for telling me.