NHL Scraper

I’ve created an NHL scraper that can be used to get GameData directly from the new NHL Api. How the scraper is built is somewhat complicated, but I basically tried to aim for four things.

Goals:

  1. User friendly: The scraper is purposely built in Power Query/Excel to make it less scary for non-data-analysts. I think the scraper is very easy to use, but it does require Excel.
  2. Data cleaning/transformation: Simply scraping shift and play-by-play data from the NHL Api is super easy… But that data isn’t worth much unless it’s cleaned and transformed into something more usable. In my scraper the shift and PBP data have Strength states as well as a connector (ShiftIndex) between the two tables.
  3. Customizability: Because the scraper is built using Power Query and Pivot tables, you can very easily add new measures to the tables using DAX code. It does require a bit of practice though. Even with the current scraper setup, you can customize the data output somewhat based on my pre-calculated measures (see more in the video below).
  4. Fast: The scraper isn’t quite as fast as I had hoped. Scraping a day’s worth of games will take somewhere between 30 seconds and 2 minutes depending on your computer, the scraper setup and how many games were played. This is fine if you’re using the scraper on a day-to-day basis, but it will take a very long time to scrape a full season.

How to use the Scraper:

  1. Download the Scraper from the Scraper section on the website or right here
  2. Make sure the Privacy setting in Excel is correct (Video)
  3. Setup the Output tables as you prefer them
  4. Choose the date range in the GameData tab.
  5. Go to Data->Refresh All

The following video illustrates how the Scraper can be used. The sound is a bit scratchy because I’m using the touchpad, but I didn’t want to retake the video.

Free to use:

The scraper is free for everyone to use. If you enjoy the scraper and my work in general, you should consider subscribing to my site or donating (any contribution is highly appreciated):

One-Time
Monthly
Yearly

Make a one-time donation

Make a monthly donation

Make a yearly donation

Choose an amount

$5.00
$15.00
$100.00
$5.00
$15.00
$100.00
$5.00
$15.00
$100.00

Or enter a custom amount

$

Your contribution is appreciated.

Your contribution is appreciated.

Your contribution is appreciated.

DonateDonate monthlyDonate yearly

I hope that this Scraper will help more people to get into hockey analytics. This is proof that you don’t necessarily need coding to get started with hockey analytics.

I understand that this scraper will get some pushback because it’s made in Power Query/Excel, but I don’t think any of the public scrapers can do as much as this scraper.

Perspectives:

  • Tutorial to come – I will do some videos explaining how the scraper is built, but it gets complicated at some point, so I may have jump over a few parts. I don’t want to make hour long videos.
  • Next step is to use the scraper to update data for the website. It’s been a few weeks since I’ve updated the player data because I wanted to get Scraper ready first.
  • Creating a Live Scraper – The current scraper doesn’t work on live games because the shift data doesn’t update until after the game. I can scrape the shift data from html reports, which updates live. It just require a bit of work.

Leave a comment