Working on something interesting from a back-end and data visualization perspective and I needed to get all of the NHL Play by Play game statistic data files, So I wrote a Node.js application called nhlplaybyplay-node that provides the means for accessing, fetching the NHL Schedule and Play by Play game data files which are in JSON format.

Hope your familiar with this…
The following URL retrieves the complete 2016-2017 NHL season schedule

While this one retrieves the entire Play by Play game data for game 2016020031 (BUF vs. EDM on October 16 @ 19:00 EDT)

Note: Schedule and Play by Play data only available from the 2011-2012 NHL Season and onward…


Once you have cloned the repo from GitHub:
git clone

You can install the dependencies with the following npm command:
npm install

Create a data directory:
mkdir data

Before using you will need to create a specific directory for each of the seasons you will be fetching data for.
i.e. To fetch data from the 2012-2013 NHL season you need to create the following folder 20122013 under the data directory.


node fetch.js season [game]

To fetch all games for a specific season:
node fetch.js 20152016

To fetch specific game from a specific season
node fetch.js 20162017 2016020001

Will be adding parsing functionallity in the near future… Enjoy!

Tagged with →  
  • disqus_LsTGv21SV1

    Hi there,

    Thanks for sharing the awesome code!

    I try to follow your instructions and download the data of 20132014 but I got the following errors. I’m wondering could you please help me take a look?

    PS. Other seasons work fine for me. It seems that 20132014 is the only season that throws me the error.


    Failed to fetch GameID: 2013020108
    Last attempted GameID: 2013020108
    detailed error: SyntaxError: Unexpected token
    in JSON at position 25703
    at JSON.parse ()
    at Request._callback (/Users/User/Desktop/nhlplaybyplay-node/fetch.js:60:86)
    at Request.self.callback (/Users/User/node_modules/request/request.js:186:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request. (/Users/User/node_modules/request/request.js:1081:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage. (/Users/User/node_modules/request/request.js:1001:12)
    at IncomingMessage.g (events.js:291:16)

  • disqus_IjHbjPKwYM


    Is there a way to locate the json for all plays such as faceoffs and stoppages?