seemethere / nba_py

Python client for NBA statistics located at stats.nba.com
BSD 3-Clause "New" or "Revised" License
1.05k stars 255 forks source link

Player Profile Picture #102

Open emmanuelobo opened 6 years ago

emmanuelobo commented 6 years ago

Does the api release the profile picture of the players?

noelvillaman commented 6 years ago

Yes. You can see on my site

http://namalliv.com/yearly/roster/1610612752/

BenikaH commented 6 years ago

Noelvillaman, can you share what function you used in nba_py to pull the image?

noelvillaman commented 6 years ago

Hi BenikaH,

In fact, I just get the playerid from team.TeamCommonRoster(teamid, season='2017-18')['PLAYER_ID'] and I use the id to complete the url since it is formed by using the player id, like this

src="http://ak-static.cms.nba.com/wp-content/uploads/headshots/nba/latest/260x190/{{ player_id }}.png

This first part is copied from nba and player_id is what I add to get the image. As I said, it is just the id. I hope this is clear, if not let me know. But the function is

from nba_py import team, then use team.TeamCommonRoster(team_id,...)

Noel.