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 412 forks source link

NextGen Stats #269

Open kpelechrinis opened 7 years ago

kpelechrinis commented 7 years ago

I had a general question whether the nfl provides an api for the nextgen stats and if yes if there are plans to integrate it with nflgame.

ochawkeye commented 7 years ago

It looks like sportsradar is the exclusive provider of these stats. Their API actually looks pretty easy to use.

I believe a trial account is limited to 1000 total API calls, and registration was easy enough so I gave it a shot. Their documentation is geared toward Python 3, but a simple conversion of http.client to httplib in their example fixes that.

import httplib
conn = httplib.HTTPSConnection("api.sportradar.us")
conn.request("GET", "/nfl-ngs-bt1/games/25fde8b4-6e4e-468c-ba0a-a511530a303c/leaders.xml?api_key=MY_API_KEY")
res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))

Unfortunately, that's about as far as I can get:

<h1>Developer Inactive</h1>

(Calling https://api.sportradar.us/nfl-ngs-bt1/games/25fde8b4-6e4e-468c-ba0a-a511530a303c/leaders.xml?api_key=MY_API_KEY and https://api.sportradar.us/nfl-ngs-bt1/games/25fde8b4-6e4e-468c-ba0a-a511530a303c/leaders.xml?api_key={MY_API_KEY} in my browser both lead to same response)

Don't know if someone on their end has to approve the app I proposed when registering for an API key before it is live or what (Their website shows that API key active on my account).

All that said, it probably isn't going to be sustainable for any project I'd want to use it for. If you plan on making fewer than 750 API calls per month, you can have access to their data for the $950/month and that ramps up to $6000/month for 35k API calls.

ochawkeye commented 7 years ago

I was able to use my trial key with the API to get schedule, player, and play-by-play (all stuff that is in nflgame) so I believe everything is functional, but I guess the next gen stats like "Play Tracking Statistics" are only available to the $6000/month Gold tier

Feed availability