seemethere / nba_py

Python client for NBA statistics located at stats.nba.com
BSD 3-Clause "New" or "Revised" License
1.05k stars 256 forks source link

figuring out players on the floor for any point in play-by-play #15

Closed ryanvmenezes closed 8 years ago

ryanvmenezes commented 8 years ago

Thanks for the in-depth documentation. I've been reading about how the API is slowly being scaled back. I would like to know if, using what currently exists, you can figure out who was on the floor for every line in the play-by-play. Using the boxscoretraditionalv2 endpoint I was able to find out all the starters and tie that to the plays I got from playbyplayv2. I thought it would be as easy as writing a script that would change players for every "SUB:" line, given the starting lineup. But what I failed to realize is that substitutions that happen between quarters are not documented in play-by-play. So I guess a simpler version of what I'm asking is, can you figure out from any of these API endpoints who started each quarter? That would help towards accomplishing my goal as well.

Other literature I've read online suggested tying the data from the locations_getmoments endpoint to do this, but I don't think that is possible anymore.

Many thanks for the great service and any help you can provide.

dblackrun commented 8 years ago

You can use the boxscore endpoint and set the start range to the start of the period and the end range to the time of the first sub.

ryanvmenezes commented 8 years ago

Thanks for the tip @dblackrun. Some testing suggests that works. I will give it a shot.