bttmly / nba

Node.js client for nba.com API endpoints
MIT License
710 stars 180 forks source link

Newest Version #87

Closed dtkavana closed 4 years ago

dtkavana commented 4 years ago

The stats api calls are still hanging for me even after the latest update. An example of a call that is hanging is: NBA.stats.playerStats({ Season: "2019-20" }).then(response => { this.playerStats = response.leagueDashPlayerStats; });

bttmly commented 4 years ago
> NBA.stats.playerStats({ Season: "2019-20" }).then(r => console.log(`found ${r.leagueDashPlayerStats.length} entries`))
> found 490 entries

The above worked for me in my Node REPL from my local machine, using nba@4.13.0 installed from NPM, not source. I'm curious where you're running this code? The NBA's API is picky about what IP addresses it accepts requests from. In particular, they block most cloud computing providers. So if you're running this from an EC2 instance, or similar on Azure, or even on something more stripped down like Linode, it will probably hang. I think they do this to make it harder to build production 3rd party applications that use their API – you're blocked in the browser by CORS restrictions, and on the backend by IP address restrictions.

bttmly commented 4 years ago

closing this, feel free to re-open but I'm pretty sure its an issue with IP blocking.