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.28k stars 413 forks source link

where did you get the schdule? #92

Closed cmosguy closed 10 years ago

cmosguy commented 10 years ago

I was curious how did you get the schedule for all the games:

https://github.com/BurntSushi/nflgame/blob/master/nflgame/schedule.json

ochawkeye commented 10 years ago

From nflgame/nflgame/update_sched.py:

def schedule_url(year, stype, week):
    """
    Returns the NFL.com XML schedule URL. `year` should be an
    integer, `stype` should be one of the strings `PRE`, `REG` or
    `POST`, and `gsis_week` should be a value in the range
    `[0, 17]`.
    """
    xmlurl = 'http://www.nfl.com/ajax/scorestrip?'
    if stype == 'POST':
        week += 17
        if week == 21:  # NFL.com you so silly
            week += 1
    return '%sseason=%d&seasonType=%s&week=%d' % (xmlurl, year, stype, week)

Something like: http://www.nfl.com/ajax/scorestrip?season=2014&seasonType=REG&week=1

BurntSushi commented 10 years ago

Thanks @ochawkeye.

@cmosguy Everything with respect to nflgame (that I've written) is open source. So it's all there. If you're curious where other stuff has come from, just ask. :-)

cmosguy commented 10 years ago

@ochawkeye @BurntSushi this is so great thanks for your help with this! BTW, just curious, have you ever figured out how to pull scores for all the NCAA football games?

BurntSushi commented 10 years ago

@cmosguy Nope. Never really looked into it.

rkmaddox commented 10 years ago

You can get scores and many other stats here: http://sportsdatabase.com/ncaafb/query. There's an API, too--pretty great site.