bbref-player-stats

1.0.10 • Public • Published

Basketball Reference Player Data Scraper

There isn't any npm package for scraping player data from basketball-reference.com so I made one myself.

Take a look at the documentation below for more information

Documentation

getAllPlayers(season, stat = 'per_game', duplicates = 'false')

Usage:

const bbstats = require("bbref-player-stats");

// Request per game player data without duplicates
const result1 = await bbstats.getAllPlayers(2021);

// Request specific stat from player data without duplicates
const result2 = await bbstats.getAllPlayers(2021, "totals");

// Request per game player data with duplicates (separate data for each team the player was on)
const result3 = await bbstats.getAllPlayers(2021, "per_game", true);

Supported stats:

'per_game', 'totals'

Return value:

Returns an array of all NBA players as JSON objects from the specified season

getPlayerStats(id, stat = 'per_game', type = 'regular')

Usage:

const bbstats = require("bbref-player-stats");

const players = await bbstats.getAllPlayers(2021);

// Request regular season per game stats using player id
const result1 = await bbstats.getPlayerStats(players[0].id);
const result2 = await bbstats.getPlayerStats("curryst01");

// Request specific stat during regular season using player id
const result3 = await bbstats.getPlayerStats("curryst01", "totals");

// Request specific stat during regular season or playoffs using player id
const result4 = await bbstats.getPlayerStats(
  "curryst01",
  "per_game",
  "playoffs"
);

Supported stats:

'per_game', 'totals', 'advanced'

Return value:

Returns an array of JSON objects, each of which is a season's worth of the given statistical data on the player

Package Sidebar

Install

npm i bbref-player-stats

Weekly Downloads

2

Version

1.0.10

License

ISC

Unpacked Size

6.59 kB

Total Files

3

Last publish

Collaborators

  • darricko