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

Is it still possible to get shot chart detail? #107

Open
ghost opened this issue Jun 25, 2021 · 1 comment
Open

Is it still possible to get shot chart detail? #107

ghost opened this issue Jun 25, 2021 · 1 comment

Comments

@ghost
Copy link

ghost commented Jun 25, 2021

Hello, I tried to fetch data about shot chart details, but it seems like stats.nba.com no longer has the servlet to handle this request. Can I still get shot chart details? Thank you!!

nba.stats.shots({
            PlayerID: this.props.playerId
        }).then((response) => {
            const final_shots = response.shot_Chart_Detail.map(shot => ({
                x: (shot.locX + 250) / 10,
                y: (shot.locY + 50) / 10,
                action_type: shot.actionType,
                shot_distance: shot.shotDistance,
                shot_made_flag: shot.shotMadeFlag,
            }));

            const courtSelection = d3.select("#shot-chart");
            const chart_court = court().width(500);
            const chart_shots = shots().shotRenderThreshold(2).displayToolTips(true).displayType("hexbin");
            courtSelection.call(chart_court);
            courtSelection.datum(final_shots).call(chart_shots);
        });
@JDhilon
Copy link

JDhilon commented Jul 26, 2021

NBA.stats.shots({PlayerID: 201939}).then(data => {
        const final_shots = data.shot_Chart_Detail.map(shot => ({
            x: (shot.locX + 250) / 10,
            y: (shot.locY + 50) / 10,
            action_type: shot.actionType,
            shot_distance: shot.shotDistance,
            shot_made_flag: shot.shotMadeFlag,
        }));

        console.log(final_shots[0]);
    });

This works for me and will log

{
  x: 13,
  y: 29,
  action_type: 'Pullup Jump shot',
  shot_distance: 26,
  shot_made_flag: 0
}

Are you getting a specific error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant