mkreiser / ESPN-Fantasy-Football-API

Connect to ESPN's fantasy football API via this JS API client for web and NodeJS. Available as an npm package.
http://espn-fantasy-football-api.s3-website.us-east-2.amazonaws.com/
GNU Lesser General Public License v3.0
296 stars 74 forks source link

Team information has last season's names #227

Closed Seth-Duncan closed 9 months ago

Seth-Duncan commented 10 months ago

Not sure what I'm doing wrong here but I'm calling the API and getting last season's team names. Is there some sort of caching issue? I get updated team abbreviations, but not team names.

I build a teamLookup to use in other areas of the app:

espnClient.getTeamsAtWeek({ seasonId: DEFAULT_SEASON_ID, scoringPeriodId: scoringPeriod }).then( response => {
            const teamLookupMap  = response.reduce((lookup, team) => ({ ...lookup, [team.id]: {
                id: team.id,
                abbreviation: team.abbreviation,
                name: team.name,
                logo: team.logoURL,
                wins: team.wins,
                losses: team.losses,
                divisionId: getTeamDivisionId(team.id)
            }}), {});
            resolve(teamLookupMap);
        }).catch(error => {
            console.log({error});
            reject('ERROR');
        });

DEFAULT_SEASON_ID = 2023 scoringPeriodId = 1

thomandretti commented 10 months ago

I'm seeing this as well. I think ESPN may have changed their data model. If I just hit this endpoint directly with CURL:

https://fantasy.espn.com/apis/v3/games/ffl/seasons/2023/segments/0/leagues/88811253?scoringPeriodId=0&view=mRoster&view=mTeam

I see that there are fields called location and nickname that have last year's info, and a field called name that has the new info. Haven't confirmed but I am guessing the library is just concatenating the location and nickname fields to populate name.

thomandretti commented 10 months ago

yeah looks to be the case

https://github.com/mkreiser/ESPN-Fantasy-Football-API/blob/main/src/team/team.js#L88

Seth-Duncan commented 10 months ago

yeah looks to be the case

https://github.com/mkreiser/ESPN-Fantasy-Football-API/blob/main/src/team/team.js#L88

Thanks for this.

mkreiser commented 9 months ago

Fixed in #229