Skip to content

Commit

Permalink
Update baskeball stat map
Browse files Browse the repository at this point in the history
  • Loading branch information
cwendt94 committed Jan 22, 2021
1 parent 705725d commit 5f52d7e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions espn_api/basketball/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@
'38': '',
'39': '',
'40': 'MIN',
'41': 'GP',
'42': '',
'41': 'GS',
'42': 'GP',
'43': '',
'44': '',
'45': '',
Expand Down

2 comments on commit 5f52d7e

@austinegri
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where can you find the idToStat map in ESPN? - for reference, trying to add this to hockey

@cwendt94
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@austinegri Unfortunately ESPN doesn't make it easy mapping the stat Id's to a readable name. You will need to look at the players stats from an API response and then try to map that stat id to the stat name you are seeing on ESPN's website.

Here is an example using a public league.

This url will get the player stats for each team in scoring period 6
GET https://fantasy.espn.com/apis/v3/games/fhl/seasons/2021/segments/0/leagues/77421173?scoringPeriodId=6&view=mMatchupScore&view=mScoreboard
The player stat data is located under this path

schedule[5]['home']['rosterForCurrentScoringPeriod']['entries'][4]['playerPoolEntry']['player']['stats'][0]['stats']

This will get you that single player stats for the scoringPeriod and will look something like this

 "stats": {
    "13": 0.0,
    "14": 1.0,
    "15": 1.0,
    "16": 1.0,
    "17": 0.0,
    "18": 0.0,
    "19": 0.0,
    "20": 0.0,
    "21": 0.0,
    "22": 0.0,
    "23": 0.0,
    "24": 0.0,
    "25": 25.0,
    "26": 1288.0,
    "27": 1288.0,
    "29": 0.0,
    "30": 1.0,
    "31": 3.0,
    "32": 4.0,
    "33": 1.0,
    "34": 1.0,
    "35": 0.0,
    "36": 0.0,
    "37": 0.0,
    "38": 0.0,
    "39": 0.0
 }

You will have to try to map these numbers to the readable names ESPN shows on their website

Please sign in to comment.