Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advanced Stats #128

Closed
danielkmetz opened this issue Jan 31, 2020 · 12 comments
Closed

Advanced Stats #128

danielkmetz opened this issue Jan 31, 2020 · 12 comments
Labels
question Inquiry from community

Comments

@danielkmetz
Copy link

Hi Everyone,

Is there a way to see a players advanced stats for every game in a season? I see there's a boxscoreadvancedstatsv2 endpoint but can't seem to get stats for every game.

@dwightgunning
Copy link

I guess you're after this table?

It's a relatively easy two-step process to figure this out. First, use your web browser developer tools / inspector to find the API endpoint URL that provides the data for the stats page (tip: filter on XHR requests with 'stats' in the url path). Then look for the endpoint name in the Endpoint documentation.

From there you can check out which parameters should be provided to retrieve the data you want.

I'm pretty sure you're looking for PlayerGameLogs with the MeasureType set to advanced.

@jonahbrennan
Copy link

I took a look at the endpoints and nothing about Injury Report jumped out at me. Does anyone know if this tracked in any of the endpoints?

@dwightgunning
Copy link

@jonahbrennan The box score summary has an InactivePlayers data set. I've not seen anything more detailed.

@SpecCRA
Copy link

SpecCRA commented Feb 4, 2020

Perhaps this should be implemented as a search in the documentation. Many times, I will go to the NBA/stats site to look up what stats are available for usage, but I could not find which API endpoint contained that stat and how to differentiate it.

More concretely, I couldn't find players' seasonal advanced statistics from this page at the end points: https://stats.nba.com/players/usage/

@dwightgunning
Copy link

dwightgunning commented Feb 5, 2020

@SpecCRA Are you checking the XHR requests that your browser is making, using inspector / developer tools, when you visit that page? It looks like leaguedashplayerstats is right there... or is that not the right one?

@SpecCRA
Copy link

SpecCRA commented Feb 6, 2020

@dwightgunning Where does it shop up in the page inspector?

Comparing with this documentation page, it does not give the same set of statistics.

@dwightgunning
Copy link

Unclear what you mean by “it”. In the inspector you have the ‘leaguedashplayerstats’ endpoint and also the query string parameters being sent with the URL (e.g. MeasureType: advanced). These parameters are described on the docs page you also found. So it’s really just a matter of combining the two sources of info to recreate the request with the nba-api.

It mght also be useful to start with some simple parameters and get some data coming back. Then refine from there.

Hope this helps.

@SpecCRA
Copy link

SpecCRA commented Feb 7, 2020

@dwightgunning Just wanted to say thanks first, and I'll give it a try soon and see how it goes!

@SpecCRA
Copy link

SpecCRA commented Feb 9, 2020

@dwightgunning That worked! I see what I was missing there now. Where in the inspector do you see the endpoints that is associated with nba-api?

@dwightgunning
Copy link

dwightgunning commented Feb 9, 2020 via email

@SpecCRA
Copy link

SpecCRA commented Feb 10, 2020

@dwightgunning I see it. Thanks for the explanation. You just made my stat search process so much easier!

@swar swar assigned swar and unassigned swar Feb 22, 2020
@swar swar added the question Inquiry from community label Feb 22, 2020
@swar
Copy link
Owner

swar commented Feb 22, 2020

Great explanation. I suggest everyone use the inspector to figure out what requests are being made when you want to find the specific endpoint that is being called.

You can always filter urls for stats and XHR requests to make finding them even easier. That's how a lot of the endpoints were discovered when I first started this package.

Closing this out, but feel free to reopen if there are more questions.

@swar swar closed this as completed Feb 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Inquiry from community
Projects
None yet
Development

No branches or pull requests

5 participants