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

URL for Player stats #302

Open mginz83 opened 7 years ago

mginz83 commented 7 years ago

I see in the py code you are using (file)/players.json. What is the full url for this?

Id like to get everything and parse it out with java code instead of python to use on my android app

mesee298 commented 7 years ago

http://www.nfl.com/players/profile?id=%s with the %s being the profile_id from the json file.

mginz83 commented 7 years ago

Is there a way to get that returned as a json? And also by year, or game, etc

mginz83 commented 7 years ago

I'm looking for a solution without using this library bc I only need it for 150 players

ochawkeye commented 7 years ago

players.json is a file contained in this library: https://github.com/BurntSushi/nflgame/blob/master/nflgame/players.json

mginz83 commented 7 years ago

That's just the player info. I need stats. For example, QB, Eli Manning, passing yards, running yards, td, interceptions

ochawkeye commented 7 years ago

I think you're misunderstanding what this library is. Those stats are precisely what this library is generating by aggregating the stats from each play in the play-by-play/game-center json files.

mginz83 commented 7 years ago

I know exactly what this lib is. But I need it for certain players, not all of them.

mginz83 commented 7 years ago

I figure if there was an easy way for me to get one player in a json, then I'm good to go

ochawkeye commented 7 years ago

I know exactly what this lib is. But I need it for certain players, not all of them. I figure if there was an easy way for me to get one player in a json, then I'm good to go

You're in luck then! This library doesn't get distributed with stats for all of the players.
Unfortunately, it doesn't include any stats for any players at all.

I'm just trying to understand what you're after here... There have been nearly 4300 unique players that have appeared in the 2048 regular season games since 2009 - the first year we have access to the game center data. (Over 7100 unique players if you include the ~600 pre- and postseason games). Is it your expectation that there exists a separate json file for each player/game? Or would it be a single json per player that contains all of their aggregated stats since 2009? Or per season?

If you can explain what you are trying to do I'd be happy to try to assist you in getting what you're looking for. I may even generate whatever files it is that you're looking for if it's just a one-time thing.

But if you're not interested in installing the library, then I'm not sure I can do much for you.

mginz83 commented 7 years ago

Lets say I have 120 players... (I'm making a fantasy football game). Every week, I have to find out what a specific player did (Eli Manning).

Lets say Im looking for stats for QBs (other positions will be different): Passing Yards Rushing Yards Interceptions Fumbles TD

From there, the card in the game uses a points system. For example, if Eli passes for 100 yards, I take his value in the game (lets say 10%) and I would multiply that by the passing yards from the json file that I parse out. From there, I display the points for passing yards. (100 * .1)

I would ned json for about 150 players for each game they play in the regular season. I do not need preseason or playoffs.

ochawkeye commented 7 years ago

Sorry. No such thing as what you're looking for.

There are game-center .jsons that you can do the job of nflgame and aggregate the stats from. An example of one of these can be found here: http://www.nfl.com/liveupdate/game-center/2016091110/2016091110_gtd.json (NYG week 1, 2016 @ DAL) (relevant code)

The game id 2016091110 in use there can be found from here: http://www.nfl.com/ajax/scorestrip?season=2016&seasonType=REG&week=1 (relevant code)

mginz83 commented 7 years ago

that could help me though.

I can get the ID from the game and then run the code.

What about for live games?

Found it. http://www.nfl.com/liveupdate/scorestrip/ss.xml

ochawkeye commented 7 years ago

What about for live games?

Exactly the same: Schedule for 2017 week 1: http://www.nfl.com/ajax/scorestrip?season=2017&seasonType=REG&week=1

NYG @ DAL: http://www.nfl.com/liveupdate/game-center/2017091012/2017091012_gtd.json once the game starts

mginz83 commented 7 years ago

I'm assuming I rely on NFL to update it, so basically just refresh every so often

mginz83 commented 7 years ago

http://www.nfl.com/ajax/scorestrip?season=2017&seasonType=REG&week=1 Is there a tag that converts this into json? I thought I saw something awhile ago when I started researching this. I thought It was something like &json=true but it didn't change it over.