npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pfr-player-data

v1.2.0

Published

Fetch NFL player data from Pro Football Reference as JSON. Scrapes a player's PFR page and returns all available stats and info.

Downloads

395

Readme

pfr-player-data

Fetch NFL player data from Pro Football Reference as JSON. ESM-only.

Install

npm install pfr-player-data

Methods

  • getPlayerData(input: string): Promise<Object> — Full parsed page (bio, raw careerStats tables, awardsAndHonors, gameLogs, url).
  • getSummaryPlayerData(input: string): Promise<Object> — Normalized career summary (name, position, careerStats by season + summary totals).
  • searchPlayers(name: string): Promise<Array<SearchResult>> — Search by player name; returns an array of matches. Use each result’s id with getPlayerData(id) or getSummaryPlayerData(id).

Input (getPlayerData / getSummaryPlayerData): player id or full URL.

  • Player id (PFR slug): 'BradTo00', 'PeteAd01', 'McNaDo00'
  • Full URL: 'https://www.pro-football-reference.com/players/B/BradTo00.htm'

API

getPlayerData(input)Promise<Object>

Fetches the player page and returns the full parsed payload: bio, summary, careerStats (raw table arrays keyed by table id, e.g. rushing_and_receiving, passing), awardsAndHonors, gameLogs, url.

getSummaryPlayerData(input)Promise<Object>

Uses getPlayerData and normalizes to a career summary: name, position, careerStats (structured by season type and category). Best for apps that need totals and a stable shape.

searchPlayers(name)Promise<Array<SearchResult>>

Searches PFR by name (e.g. 'tom brady', 'adrian peterson'). Returns an array of results; use each result’s id with getPlayerData(id) or getSummaryPlayerData(id).

Return shape — each element is:

| Property | Type | Description | | ------------ | -------- | ----------- | | id | string | PFR player slug (e.g. 'BradTo00', 'PeteAd01'). | | name | string | Full name as on PFR. | | position | string | Position (e.g. 'QB', 'RB'). | | yearsActive| string | Career span as 'YYYY-YYYY' (e.g. '2000-2022'). | | teams | string[] | Sorted list of 2–3 letter team abbreviations (e.g. ['NWE', 'TAM']). |

Usage

import { getPlayerData, getSummaryPlayerData, searchPlayers } from 'pfr-player-data';

// Search by name, then fetch with chosen id
const results = await searchPlayers('tom brady');
// [{ id: 'BradTo00', name: 'Tom Brady', position: 'QB', yearsActive: '2000-2022', teams: ['NWE', 'TAM'] }]
const summary = await getSummaryPlayerData(results[0].id);

const multi = await searchPlayers('adrian peterson');
// Multiple results; pick by id, e.g. multi[1].id for PeteAd01
const other = await getSummaryPlayerData(multi[1].id);

// Or call directly with id / URL
const full = await getPlayerData('BradTo00');
const s = await getSummaryPlayerData('McNaDo00');

Summary response shape

getSummaryPlayerData returns:

{
  name: string;
  position: string;
  careerStats: {
    regularSeason: {
      passing: { passCmp?, passAtt?, passYds?, passTd?, passInt?, passCmpPct?, passYdsPerAtt?, passYdsPerCmp?, passYdsPerG?, comebacks?, gwd?, games?, gamesStarted?, av?, awards?, ... };
      rushingReceiving: { games?, gamesStarted?, rushAtt?, rushYds?, rushTd?, rec?, recYds?, recTd?, touches?, ydsFromScrimmage?, rushReceiveTd?, fumbles?, av?, awards?, ... };
      teams: string[];
    };
    postSeason: {
      passing: { ... };      // same keys as regularSeason.passing
      rushingReceiving: { ... };
      teams: string[];
    };
    allSeason: {
      passing: { ... };     // cumulative (reg + post)
      rushingReceiving: { ... };
      teams: string[];
    };
    summary: {
      tdsAll: number;      // tdsRush + tdsRec + tdsPass
      tdsRush: number;
      tdsRec: number;
      tdsPass: number;
      ydsAll: number;      // ydsRush + ydsRec + ydsPass
      ydsRush: number;
      ydsRec: number;
      ydsPass: number;
    };
  };
}
  • Passing is populated from the PFR passing table (QBs); rushingReceiving from the rushing & receiving table. Missing categories are {}.
  • summary values are derived from allSeason (regular + postseason combined).

Example output

{
  "name": "Adrian Peterson",
  "position": "RB",
  "careerStats": {
    "regularSeason": {
      "passing": {},
      "rushingReceiving": {
        "games": 184,
        "gamesStarted": 167,
        "rushAtt": 3230,
        "rushYds": 14918,
        "rushTd": 120,
        "rec": 305,
        "recYds": 2474,
        "recTd": 6,
        "touches": 3535,
        "ydsFromScrimmage": 17392,
        "rushReceiveTd": 126,
        "fumbles": 49,
        "av": 129
      },
      "teams": ["ARI", "DET", "MIN", "NOR", "SEA", "TEN", "WAS"]
    },
    "postSeason": { "passing": {}, "rushingReceiving": { ... }, "teams": [] },
    "allSeason": { "passing": {}, "rushingReceiving": { ... }, "teams": [] },
    "summary": {
      "tdsAll": 131,
      "tdsRush": 125,
      "tdsRec": 6,
      "tdsPass": 0,
      "ydsAll": 17858,
      "ydsRush": 15330,
      "ydsRec": 2528,
      "ydsPass": 0
    }
  }
}

Notes

  • ESM only. Use import; no CommonJS support.
  • Not affiliated with Sports Reference LLC. Data is scraped from public pages.
  • Use reasonable request frequency and caching; respect PFR terms of use.

License

ISC