bttmly / nba

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

Team and Player Images #104

Closed wkennedy8 closed 3 years ago

wkennedy8 commented 3 years ago

Is it possible to retrieve images for players and teams?

bttmly commented 3 years ago

You can use this package to find the player id of a specific player. I noticed on the NBA's website, images include the player id in the URL – here's steph curry's: https://cdn.nba.com/headshots/nba/latest/1040x760/201939.png

and here's his entry in the players.json file:

  {    "firstName": "Stephen",    "lastName": "Curry",    "playerId": 201939,    "teamId": 1610612744  },

as you can see the player id matches, so I think you can take that URL and plug in any player id and get an image for the player.

not sure about team logos though – but there are only 30 of them and they rarely change so it seems less important to fetch them dynamically.