API to fetch team logo
fzymek opened this issue · comments
Filip Zymek commented
Hello
It would be great if there was an API call that will return url to team logo. Something like eg:
var url = nba.getTeamLogo(teamId)
Nick Bottomley commented
here you go, this will get the URLs of the SVGs used on http://stats.nba.com/teams/
const nba = require("nba");
function teamLogoUrl (teamId) {
const team = nba.teams.find(t => t.teamId === teamId);
if (team == null) return null;
return `http://stats.nba.com/media/img/teams/logos/${team.abbreviation}_logo.svg`
}
(if they change their image URLs this will break, but should be easy enough to fix based on whatever scheme they are using)
Filip Zymek commented
Great, thanks!