toddrob99 / MLB-StatsAPI

Python wrapper for MLB Stats API
GNU General Public License v3.0
533 stars 100 forks source link

Pitches per inning #81

Closed apelt001 closed 2 years ago

apelt001 commented 2 years ago

Is there an easy way to get pitches per inning for a given gamePk? I can't seem to find out which timecodes correspond to end of innings.

toddrob99 commented 2 years ago

Pitch data is in the game endpoint...

For example, go here: https://statsapi.mlb.com/api/v1.1/game/661722/feed/live and find liveData > plays > allPlays. That is a list of plays in the game, and you'll find the inning in the about dict along with the pitches in the playEvents (list use pitchIndex to know which playEvents are pitches).

apelt001 commented 2 years ago

Wow this is great, thank you. What about if I just want pitch count per inning by pitcher. Would I have to code that up myself?

toddrob99 commented 2 years ago

I think so... It has total pitches for each pitcher, but not broken down by inning as far as I have seen.