BurntSushi / nflgame

An API to retrieve and read NFL Game Center JSON data. It can work with real-time data, which can be used for fantasy football.
http://pdoc.burntsushi.net/nflgame
The Unlicense
1.27k stars 413 forks source link

LA Chargers Issues #311

Closed mesee298 closed 7 years ago

mesee298 commented 7 years ago

Also posted on nfldb, but wasn't sure if it should have been here instead?

So, after reading about LA Rams changes last year, I was able to add the Chargers for the schedule and it works great. Now the player table still shows on 'SD' instead of 'LAC'. I ran update-players.py, and players.json still shows as 'SD'. I assume this is an issue with nfl.com, but you know what happens when you assume. :)

If it is an nfl.com issue, when have you seen it rectified in the past?

If it isn't an nfl.com issue, what can I do to make the players show up on 'LAC'?

jaydeluca commented 7 years ago

I am also curious about this. I have spot checked some other players that have changed teams and even after running the player-update it doesn't seem that the data reflects this

ochawkeye commented 7 years ago

I think this most likely has to do with how nflgame goes through and grabs rosters for each team found in nflgame.teams.

If you've added 'LAC' to your list in alphabetical order, all of the players on that team are probably being updated...but only for a moment. When nflgame gets down to your 'SD' line, it tries to hit NFL.com to download that roster (roster_soup / url).

The actual URL being used for the Charges in an un-modified NFL game is "http://www.nfl.com/teams/roster?team=SD". When the request for that page is made, NFL.com automatically redirects to "http://www.nfl.com/teams/roster?team=LAC" and happily downloads the roster but as far as nflgame knows, "SD" is a perfectly valid team name. And all of the players that were just updated to 'LAC' a moment ago are now back on 'SD'.

Easiest way around this for the time being to maintain backward compatibility with the legit "SD" that played in the league all these years, is to simply move your "SD" entry in the teams list to before "LAC".

ie.

teams = [
    ['ARI', 'Arizona', 'Cardinals', 'Arizona Cardinals'],
    ['ATL', 'Atlanta', 'Falcons', 'Atlanta Falcons'],
    ['BAL', 'Baltimore', 'Ravens', 'Baltimore Ravens'],
    ['BUF', 'Buffalo', 'Bills', 'Buffalo Bills'],
    ['CAR', 'Carolina', 'Panthers', 'Carolina Panthers'],
    ['CHI', 'Chicago', 'Bears', 'Chicago Bears'],
    ['CIN', 'Cincinnati', 'Bengals', 'Cincinnati Bengals'],
    ['CLE', 'Cleveland', 'Browns', 'Cleveland Browns'],
    ['DAL', 'Dallas', 'Cowboys', 'Dallas Cowboys'],
    ['DEN', 'Denver', 'Broncos', 'Denver Broncos'],
    ['DET', 'Detroit', 'Lions', 'Detroit Lions'],
    ['GB', 'Green Bay', 'Packers', 'Green Bay Packers', 'G.B.', 'GNB'],
    ['HOU', 'Houston', 'Texans', 'Houston Texans'],
    ['IND', 'Indianapolis', 'Colts', 'Indianapolis Colts'],
    ['JAX', 'Jacksonville', 'Jaguars', 'Jacksonville Jaguars', 'JAC'],
    ['KC', 'Kansas City', 'Chiefs', 'Kansas City Chiefs', 'K.C.', 'KAN'],
    ['LA', 'Los Angeles', 'Rams', 'Los Angeles Rams', 'L.A.'],
    ['SD', 'San Diego', 'Chargers', 'San Diego Chargers', 'S.D.', 'SDG'],   # Moved this guy up here
    ['LAC', 'Chargers', 'Los Angeles Chargers', 'L.A.C.'],
    ['MIA', 'Miami', 'Dolphins', 'Miami Dolphins'],
    ['MIN', 'Minnesota', 'Vikings', 'Minnesota Vikings'],
    ['NE', 'New England', 'Patriots', 'New England Patriots', 'N.E.', 'NWE'],
    ['NO', 'New Orleans', 'Saints', 'New Orleans Saints', 'N.O.', 'NOR'],
    ['NYG', 'Giants', 'New York Giants', 'New York G', 'N.Y.G.'],
    ['NYJ', 'Jets', 'New York Jets', 'New York J', 'N.Y.J.'],
    ['OAK', 'Oakland', 'Raiders', 'Oakland Raiders'],
    ['PHI', 'Philadelphia', 'Eagles', 'Philadelphia Eagles'],
    ['PIT', 'Pittsburgh', 'Steelers', 'Pittsburgh Steelers'],
    ['SEA', 'Seattle', 'Seahawks', 'Seattle Seahawks'],
    ['SF', 'San Francisco', '49ers', 'San Francisco 49ers', 'S.F.', 'SFO'],
    ['STL', 'St. Louis', 'Rams', 'St. Louis Rams', 'S.T.L.'],
    ['TB', 'Tampa Bay', 'Buccaneers', 'Tampa Bay Buccaneers', 'T.B.', 'TAM'],
    ['TEN', 'Tennessee', 'Titans', 'Tennessee Titans'],
    ['WAS', 'Washington', 'Redskins', 'Washington Redskins', 'WSH'],
]