Closed bialesdaniel closed 4 years ago
are you making requests from your local machine or from a cloud instance? nba.com blocks ip addresses of known cloud providers by letting requests hang and time out.
they also do rate limiting.
I'm running it locally. I'm probably hitting the rate limit. Any chance you know what that is?
No, I think it varies by endpoint. But if I need to run a lot of requests I just try to do 1 per second then walk away and wait for it to finish. something more or less like this
const delay = ms => new Promise(r => setTimeout(r, ms));
const playerInfo = [];
for (const player of players) {
playerInfo.push(await nba.playerInfo({ PlayerID: player.PlayerID });
await delay(1000);
}
I am getting a lot of timeouts
Is there some throttling or quotas on the nba endpoints? or is there some way to get around this?