{"action":"created","issue":{"url":"https://api.github.com/repos/BurntSushi/nfldb/issues/82","labels_url":"https://api.github.com/repos/BurntSushi/nfldb/issues/82/labels{/name}","comments_url":"https://api.github.com/repos/BurntSushi/nfldb/issues/82/comments","events_url":"https://api.github.com/repos/BurntSushi/nfldb/issues/82/events","html_url":"https://github.com/BurntSushi/nfldb/issues/82","id":67234198,"number":82,"title":"Data before 2009","user":{"login":"andr3w321","id":1230185,"avatar_url":"https://avatars.githubusercontent.com/u/1230185?v=3","gravatar_id":"","url":"https://api.github.com/users/andr3w321","html_url":"https://github.com/andr3w321","followers_url":"https://api.github.com/users/andr3w321/followers","following_url":"https://api.github.com/users/andr3w321/following{/other_user}","gists_url":"https://api.github.com/users/andr3w321/gists{/gist_id}","starred_url":"https://api.github.com/users/andr3w321/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andr3w321/subscriptions","organizations_url":"https://api.github.com/users/andr3w321/orgs","repos_url":"https://api.github.com/users/andr3w321/repos","events_url":"https://api.github.com/users/andr3w321/events{/privacy}","received_events_url":"https://api.github.com/users/andr3w321/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-04-08T22:30:00Z","updated_at":"2015-04-14T19:21:27Z","closed_at":null,"body":"Are there are any scripts already written to get data before 2009?  I see that data at http://www.nfl.com/ajax/scorestrip?season=2014&seasonType=REG&week=1 goes back to 1970 for regular season.  Is there an api doc page for nfl.com somewhere?  This only gives gsis_ids, datetimes and scores.  I'd be interested in more stats even if they're not complete drive by drive stats.\r\n\r\nUpdate: I see you can match the gsis id with gamebook data here: http://www.nflgsis.com/1999/Reg/15/796/Gamebook.xml\r\n\r\nIn a somewhat unrelated note is it normal for `nflgame-update-players` to require `sudo`?  I installed with `pip install nfldb --user` and I get `I do not have write access to \"/usr/local/lib/python2.7/dist-packages/nflgame/players.json\".` when I try running it without.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/BurntSushi/nfldb/issues/comments/93026537","html_url":"https://github.com/BurntSushi/nfldb/issues/82#issuecomment-93026537","issue_url":"https://api.github.com/repos/BurntSushi/nfldb/issues/82","id":93026537,"user":{"login":"andr3w321","id":1230185,"avatar_url":"https://avatars.githubusercontent.com/u/1230185?v=3","gravatar_id":"","url":"https://api.github.com/users/andr3w321","html_url":"https://github.com/andr3w321","followers_url":"https://api.github.com/users/andr3w321/followers","following_url":"https://api.github.com/users/andr3w321/following{/other_user}","gists_url":"https://api.github.com/users/andr3w321/gists{/gist_id}","starred_url":"https://api.github.com/users/andr3w321/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andr3w321/subscriptions","organizations_url":"https://api.github.com/users/andr3w321/orgs","repos_url":"https://api.github.com/users/andr3w321/repos","events_url":"https://api.github.com/users/andr3w321/events{/privacy}","received_events_url":"https://api.github.com/users/andr3w321/received_events","type":"User","site_admin":false},"created_at":"2015-04-14T19:21:27Z","updated_at":"2015-04-14T19:21:27Z","body":"Thanks for your help.  I wrote some code to look at the team names and mascots.  The only city name in question is RAI, which looks like it refers to the LA Raiders http://www.pro-football-reference.com/teams/rai/  The problem with just adding the unknown teams listed above is it will describe the 1983 Baltimore Ravens which were actually the Colts so to get it really done correctly would require adding the below teams.txt table to the db.  I submitted a pull request with the update_sched.py --build-old method I added.\r\n\r\nprint_teams_table.py\r\n```\r\nimport xml.dom.minidom as xml\r\nimport os\r\nimport re \r\n\r\nnfl_schedules_path = './nfl-schedules'\r\n\r\ndef sort_nicely( l ): \r\n  \"\"\" Sort the given list in the way that humans expect. \r\n  \"\"\" \r\n  convert = lambda text: int(text) if text.isdigit() else text \r\n  alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ] \r\n  l.sort( key=alphanum_key ) \r\n\r\ndef get_filenames(dir_path, starts_with, ends_with):\r\n    \"\"\"\r\n    Returns a list of all filenames in a dir\r\n    that starts with a given string \r\n    and ends with a given string\r\n    eg: get_filenames(\"./nfl-schedules\", \"1970\", \".xml\")\r\n    \"\"\"\r\n    filenames = []\r\n    try:\r\n        for file in os.listdir(dir_path):\r\n            if file.startswith(starts_with) and file.endswith(ends_with):\r\n                filenames.append(file)\r\n    except OSError:\r\n        sys.stderr.write(\"could not load %s\\n\" % dir_path)\r\n    return filenames\r\n\r\ndef add_sym_mascot_year(sym, mascot, year, teams):\r\n    team_idx = -1\r\n    for i in range(0, len(teams)):\r\n        if teams[i][0] == sym and teams[i][1] == mascot:\r\n            team_idx = i\r\n            break\r\n    if team_idx == -1:\r\n        teams.append([sym.encode('utf-8'), mascot.encode('utf-8'), [year]])\r\n    else:\r\n        if year not in teams[team_idx][2]:\r\n            teams[team_idx][2].append(year)\r\n    return teams\r\n\r\n\r\nxml_filenames = get_filenames(nfl_schedules_path, \"\", \".xml\")\r\nsort_nicely(xml_filenames)\r\nxml_filenames.reverse()\r\nteams = []\r\nfor xml_file in xml_filenames:\r\n    year,week,stype = xml_file.split(\".xml\")[0].split(\"-\")\r\n    year = int(year)\r\n    week = int(week)\r\n\r\n    xml_filename = nfl_schedules_path + \"/\" + str(year) + \"-\" + str(week) + \"-\" + stype + \".xml\"\r\n    try:\r\n        dom = xml.parse(open(xml_filename))\r\n    except IOError:\r\n        sys.stderr.write(\"could not load %s\\n\" % xml_filename)\r\n\r\n\r\n    for g in dom.getElementsByTagName(\"g\"):\r\n        home_sym = g.getAttribute('h')\r\n        home_mas = g.getAttribute('hnn')\r\n        away_sym = g.getAttribute('v')\r\n        away_mas = g.getAttribute('vnn')\r\n\r\n        teams = add_sym_mascot_year(home_sym, home_mas, year, teams)\r\n        teams = add_sym_mascot_year(away_sym, away_mas, year, teams)\r\nteams.sort()\r\nfor team in teams:\r\n    print team\r\n```\r\n\r\npython print_teams_table.py > teams.txt\r\n```\r\n['ARI', 'cardinals', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994]]\r\n['ATL', 'falcons', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['BAL', 'colts', [1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['BAL', 'ravens', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996]]\r\n['BOS', 'patriots', [1970]]\r\n['BUF', 'bills', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['CAR', 'panthers', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995]]\r\n['CHI', 'bears', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['CIN', 'bengals', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['CLE', 'browns', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['DAL', 'cowboys', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['DEN', 'broncos', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['DET', 'lions', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['GB', 'packers', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['HOU', 'oilers', [1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['HOU', 'texans', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002]]\r\n['IND', 'colts', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984]]\r\n['JAC', 'jaguars', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995]]\r\n['KC', 'chiefs', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['LA', 'rams', [1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['MIA', 'dolphins', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['MIN', 'vikings', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['NE', 'patriots', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971]]\r\n['NO', 'saints', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['NYG', 'giants', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['NYJ', 'jets', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['OAK', 'raiders', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['PHI', 'eagles', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['PHO', 'cardinals', [1993, 1992, 1991, 1990, 1989, 1988]]\r\n['PIT', 'steelers', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['RAI', 'raiders', [1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982]]\r\n['RAM', 'rams', [1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982]]\r\n['SD', 'chargers', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['SEA', 'seahawks', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976]]\r\n['SF', '49ers', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['STL', 'cardinals', [1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n['STL', 'rams', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995]]\r\n['TB', 'buccaneers', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976]]\r\n['TEN', 'oilers', [1998, 1997]]\r\n['TEN', 'titans', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999]]\r\n['WAS', 'redskins', [2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970]]\r\n```"}}