# Hockey Reference Scraper - NHL Player Stats (`lulzasaur/hockey-reference-scraper`) Actor

Scrape Hockey-Reference.com for NHL and WHA player stats. Browse 8,700+ players by letter or get detailed career stats with goals, assists, points, plus/minus, penalty minutes, and point shares.

- **URL**: https://apify.com/lulzasaur/hockey-reference-scraper.md
- **Developed by:** [lulz bot](https://apify.com/lulzasaur) (community)
- **Categories:** E-commerce
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Hockey Reference Scraper

Scrape NHL and WHA player statistics from [Hockey-Reference.com](https://www.hockey-reference.com). Browse 8,700+ players across 26 letter index pages, or get detailed career stats including goals, assists, points, plus/minus, penalty minutes, and point shares.

### Features

- **Index Mode** - Browse player index pages by letter. Extract names, positions, years active, and league (NHL/WHA)
- **Detailed Mode** - Follow player URLs for full career stats with season-by-season breakdowns
- **Skater Stats** - Goals, assists, points, plus/minus, penalty minutes, shots, shooting %, TOI, faceoffs, hits, blocks
- **Goalie Stats** - Wins, losses, GAA, save %, shutouts, quality starts, goals saved above average
- **Playoff Stats** - Separate regular season and playoff stat tables
- **Point Shares** - Offensive/defensive point shares from misc stats table
- **Hall of Fame** - Identifies Hall of Famers from bold formatting on index pages
- **Biographical Info** - Name, position, shoots/catches, height, weight, birth date, birth place, draft info

### Modes

#### Index Mode (`index`)

Lists all players from one or more letter index pages. Fast, lightweight, no player page requests needed.

**Input:**
- `scrapeType` = `index`
- `letter` - Optional single letter a-z (leave empty for all 26 letters)
- `maxResults` - Maximum players to return (default: 500, max: 10000)

**Output:**
```json
{
  "name": "Wayne Gretzky",
  "position": "C",
  "yearsActive": "1979-1999",
  "league": "NHL",
  "isHallOfFamer": true,
  "url": "https://www.hockey-reference.com/players/g/grMDwa99.html",
  "letter": "g",
  "scrapedAt": "2026-04-25T12:00:00.000Z"
}
````

#### Detailed Mode (`detailed`)

Fetches index pages first, then follows each player URL to extract full career statistics. Slower due to per-player requests with 3s rate limiting.

**Input:**

- `scrapeType` = `detailed`
- `letter` - Optional single letter (recommended to limit scope)
- `maxResults` - Maximum players to scrape (default: 500)

**Skater Output:**

```json
{
  "name": "Wayne Gretzky",
  "position": "Center",
  "shoots": "Left",
  "height": "6-0",
  "weight": "185",
  "birthDate": "1961-01-26",
  "birthPlace": "Brantford, ON, CA",
  "isGoalie": false,
  "regularSeason": [
    {
      "season": "1979-80",
      "team": "EDM",
      "league": "NHL",
      "gamesPlayed": 79,
      "goals": 51,
      "assists": 86,
      "points": 137,
      "plusMinus": 15,
      "penaltyMinutes": 21,
      "powerPlayGoals": 13,
      "shots": 284,
      "shootingPct": 17.96
    }
  ],
  "regularSeasonCareerTotals": { "goals": 894, "assists": 1963, "points": 2857 },
  "playoffStats": [...],
  "playoffCareerTotals": {...},
  "miscStats": [...],
  "careerGoals": 894,
  "careerAssists": 1963,
  "careerPoints": 2857,
  "careerPointShares": 186.6,
  "url": "https://www.hockey-reference.com/players/g/gretzwa01.html"
}
```

**Goalie Output:**

```json
{
  "name": "Martin Brodeur",
  "position": "Goalie",
  "isGoalie": true,
  "regularSeason": [
    {
      "season": "1993-94",
      "team": "NJD",
      "gamesPlayed": 47,
      "wins": 27,
      "losses": 11,
      "goalsAgainstAvg": 2.40,
      "savePct": 0.915,
      "shutouts": 3
    }
  ],
  "careerWins": 691,
  "careerShutouts": 125,
  "careerSavePct": 0.912
}
```

### Skater Stats Extracted

Games Played (GP), Goals (G), Assists (A), Points (PTS), Plus/Minus (+/-), Penalty Minutes (PIM), Even Strength Goals, Power Play Goals, Short Handed Goals, Game Winning Goals, Even Strength Assists, Power Play Assists, Short Handed Assists, Shots, Shooting %, Time on Ice, Avg TOI, Faceoff Wins/Losses/%, Hits, Blocks, Takeaways, Giveaways

### Goalie Stats Extracted

Games Played, Games Started, Wins, Losses, Ties, OT Losses, Goals Against, Shots Against, Saves, Save %, Goals Against Average, Shutouts, Minutes Played, Quality Starts, Quality Start %, Really Bad Starts, Goals Saved Above Average, Point Shares

### Point Shares (Misc Stats)

Offensive Point Shares (OPS), Defensive Point Shares (DPS), Total Point Shares (PS)

### Rate Limiting

The scraper uses a 3-second delay between all HTTP requests to respect Hockey-Reference's rate limits. Cloudflare protection is present but generally passes through with proper headers. For large runs, residential proxies are recommended.

### Proxy Configuration

Hockey-Reference may rate-limit aggressive scraping. The default configuration uses Apify residential proxies for reliability.

### Technical Notes

- Uses `got-scraping` + `cheerio` for fast HTML parsing (no browser needed)
- Extracts data from `data-stat` attributes on table cells for reliable field mapping
- Parses JSON-LD `schema.org/Person` data for biographical information
- Handles HTML comments (Hockey-Reference hides some stat tables inside comments)
- Automatically detects goalies vs skaters and extracts appropriate stat tables
- Incremental data pushing every 10 players in detailed mode
- Pay-per-event charging: billed per result returned

# Actor input Schema

## `scrapeType` (type: `string`):

What to scrape: 'index' lists players from letter index pages, 'detailed' follows player URLs for full career stats.

## `letter` (type: `string`):

Single letter a-z to scrape only that letter's index page. Leave empty to scrape all 26 letters.

## `maxResults` (type: `integer`):

Maximum number of player results to return.

## `proxyConfiguration` (type: `object`):

Proxy settings. Recommended for large-scale runs to avoid rate limiting.

## Actor input object example

```json
{
  "scrapeType": "index",
  "letter": "a",
  "maxResults": 500,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "letter": "a"
};

// Run the Actor and wait for it to finish
const run = await client.actor("lulzasaur/hockey-reference-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "letter": "a" }

# Run the Actor and wait for it to finish
run = client.actor("lulzasaur/hockey-reference-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "letter": "a"
}' |
apify call lulzasaur/hockey-reference-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=lulzasaur/hockey-reference-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Hockey Reference Scraper - NHL Player Stats",
        "description": "Scrape Hockey-Reference.com for NHL and WHA player stats. Browse 8,700+ players by letter or get detailed career stats with goals, assists, points, plus/minus, penalty minutes, and point shares.",
        "version": "1.0",
        "x-build-id": "Nhh7ECLP2IH9pSdXh"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/lulzasaur~hockey-reference-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-lulzasaur-hockey-reference-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/lulzasaur~hockey-reference-scraper/runs": {
            "post": {
                "operationId": "runs-sync-lulzasaur-hockey-reference-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/lulzasaur~hockey-reference-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-lulzasaur-hockey-reference-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "scrapeType": {
                        "title": "Scrape Type",
                        "enum": [
                            "index",
                            "detailed"
                        ],
                        "type": "string",
                        "description": "What to scrape: 'index' lists players from letter index pages, 'detailed' follows player URLs for full career stats.",
                        "default": "index"
                    },
                    "letter": {
                        "title": "Letter (optional)",
                        "type": "string",
                        "description": "Single letter a-z to scrape only that letter's index page. Leave empty to scrape all 26 letters."
                    },
                    "maxResults": {
                        "title": "Max Results",
                        "minimum": 1,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Maximum number of player results to return.",
                        "default": 500
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Proxy settings. Recommended for large-scale runs to avoid rate limiting.",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ]
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
