Web Scraping Basketball Data Using BeautifulSoup

February 2021

Introduction

With the installation of player-tracking technology in NBA arenas, suddenly the amount of data being collected is increasing exponentially. With an abundance of accessible data, it can be tedious and inefficient to manually scrape each site individually, and one solution is to write a program that automates this process.

Data from NBA.com

The picture to the right shows statistical leaders from the 2020-2021 season.

BeautifulSoup

The Python package known as BeautifulSoup navigates to NBA.com, parses the HTML code, and extracts column names and the player data.

The code linked below scrapes data from NBA.com, WNBA.com, Basketball-Reference.com, and ESPN.com.