Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get live NFL scores/stats to read and manipulate?

I need some sort of database or feed to access live scores(and possibly player stats) for the NFL. I want to be able to display the scores on my site for my pickem league and show the users if their pick is winning or not.

I'm not sure how to go about this. Can someone point me in the right direction?

Also, it needs to be free.

like image 958
John Salvetti Avatar asked Sep 08 '13 17:09

John Salvetti


People also ask

Where can I find advanced NFL stats?

NFLsavant.com: Advanced NFL Statistics.

Can you download NFL stats?

All data and stats from this site are compiled from publicly-available NFL play-by-play data on the internet. Can I have your data? Yes! Download the 2022 play by play data here.

What app shows NFL scores?

Pro Football Live: NFL Scores 17+

How does the NFL keep track of stats?

A tracking system is installed in every NFL venue which is composed of: 20–30 ultra-wide band receivers. 2–3 radio-frequency identification (RFID) tags installed into the players' shoulder pads. RFID tags on officials, pylons, sticks, chains, and in the ball.


2 Answers

Disclaimer: I'm the author of the tools I'm about to promote.

Over the past year, I've written a couple Python libraries that will do what you want. The first is nflgame, which gathers game data (including play-by-play) from NFL.com's GameCenter JSON feed. This includes active games where data is updated roughly every 15 seconds. nflgame has a wiki with some tips on getting started.

I released nflgame last year, and used it throughout last season. I think it is reasonably stable.

Over this past summer, I've worked on its more mature brother, nfldb. nfldb provides access to the same kind of data nflgame does, except it keeps everything stored in a relational database. nfldb also has a wiki, although it isn't entirely complete yet.

For example, this will output all current games and their scores:

import nfldb

db = nfldb.connect()

phase, year, week = nfldb.current(db)
q = nfldb.Query(db).game(season_year=year, season_type=phase, week=week)
for g in q.as_games():
    print '%s (%d) at %s (%d)' % (g.home_team, g.home_score,
                                  g.away_team, g.away_score)

Since no games are being played, that outputs all games for next week with 0 scores. This is the output with week=1: (of the 2013 season)

CLE (10) at MIA (23)
DET (34) at MIN (24)
NYJ (18) at TB (17)
BUF (21) at NE (23)
SD (28) at HOU (31)
STL (27) at ARI (24)
SF (34) at GB (28)
DAL (36) at NYG (31)
WAS (27) at PHI (33)
DEN (49) at BAL (27)
CHI (24) at CIN (21)
IND (21) at OAK (17)
JAC (2) at KC (28)
PIT (9) at TEN (16)
NO (23) at ATL (17)
CAR (7) at SEA (12)

Both are licensed under the WTFPL and are free to use for any purpose.

N.B. I realized you tagged this as PHP, but perhaps this will point you in the right direction. In particular, you could use nfldb to maintain a PostgreSQL database and query it with your PHP program.

like image 85
BurntSushi5 Avatar answered Oct 14 '22 01:10

BurntSushi5


So I found something that gives me MOST of what I was looking for. It has live game stats, but doesn't include current down, yards to go, and field position.

Regular Season: http://www.nfl.com/liveupdate/scorestrip/ss.xml

Post Season: http://www.nfl.com/liveupdate/scorestrip/postseason/ss.xml

I'd still like to find a live player stat feed to use to add Fantasy Football to my website, but I don't think a free one exists.

like image 45
John Salvetti Avatar answered Oct 14 '22 00:10

John Salvetti