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 🙏

© 2024 – Pkg Stats / Ryan Hefner

basketball-reference-player-scraper

v1.1.0

Published

A simple web scraper for NBA player data via Basketball-Reference

Downloads

93

Readme

Basketball-Reference Player Scraper

It's amazing how this website refuses to provide a public API after all of these years.

However, be responsible.

Getting Started

npm install basketball-reference-player-scraper

const { getPlayer } = require('basketball-reference-player-scraper')
const data = await getPlayer('Anthony, Carmelo')

Output Sample

{
  "bio": {
    "accolades": [
      "10x All Star",
      "2012-13 Scoring Champ",
      "6x All-NBA",
      "2003-04 All-Rookie"
    ],
    "attributes": { "hand": "Right", "height": "201", "weight": "107" },
    "age": "37-133d",
    "birthplace": "Brooklyn, New York us",
    "draft": {
      "team": "Denver Nuggets",
      "year": 2003,
      "position": { "round": 1, "position": 3 }
    },
    "education": {
      "college": ["Syracuse"],
      "highSchool": [
        "Towson Catholic in Towson, Maryland",
        "Oak Hill Academy in Mouth of Wilson, Virginia"
      ]
    },
    "name": "\n\t\tCarmelo Anthony\n\t\t\t",
    "nicknames": ["Melo", " Hoodie Melo", " Sweet Melon", " Mel"],
    "position": ["Small Forward", "Power Forward"],
    "dob": "May 29, 1984"
  },
  "contract": null,
  "honors": [
    {
      "label": "All-Star Games",
      "results": [
        { "honor": "2007 NBA", "rank": "2007 NBA" },
        ...
  ],
  "per_game": [
    {
      "season": "2003-04",
      "age": 19,
      "team_id": "DEN",
      "lg_id": "NBA",
      "pos": "SF",
      "g": 82,
      "gs": 82,
      "mp_per_g": 36.5,
...

Full Sample Here

Options

const { getPlayer } = require('basketball-reference-player-scraper')
const data = await getPlayer('Anthony, Carmelo', {
  contract: true,
  honors: true,
  tableIDs: ['advanced'],
  bio: true
})

Contract

Include the player contract table (default: false).

Honors

Include the honors and leaderboard table (default: true).

Bio

Include basic bio info like education, birthdate, etc (default: true)

Table IDs

Tables to include within the output (default: advanced).

const VALID_TABLE_IDS = [
  'advanced',
  'all_college_stats',
  'all_salaries',
  'all_star',
  'pbp',
  'per_game',
  'per_minute',
  'per_poss',
  'playoffs_advanced',
  'playoffs_pbp',
  'playoffs_per_game',
  'playoffs_per_minute',
  'playoffs_per_poss',
  'playoffs_shooting',
  'playoffs_totals',
  'shooting',
  'sim_career',
  'sim_thru',
  'totals',
  'year-and-career-highs-po',
  'year-and-career-highs'
]