A Python client for scraping stats and data from Basketball Reference
Project description
basketball_reference_scraper
Basketball Reference is a great resource to aggregate statistics on NBA teams, seasons, players, and games. This package provides methods to acquire data for all these categories in pre-parsed and simplified formats.
Installing
Via pip
I wrote this library as an exercise for creating my first PyPi package. Hopefully, you find it easy to use. Install using the following command:
pip install basketball-reference-scraper
If you're getting issues installing the dependencies listed in the install_requires
or requirements.txt
files. Try installing them manually via these commands:
python -m pip install pandas
python -m pip install bs4
python -m pip install lxml
This is caused by an ongoing issue with pip.
Via GitHub
Alternatively, you can just clone this repo and import the libraries at your own discretion.
Note that this means you may have to install additional python packages including requests
, asyncio
, pandas
, and pyppeteer
.
Wait, don't scrapers like this already exist?
Yes, scrapers and APIs do exist. The primary API used currently is for stats.nba.com, but the website blocks too many requests, hindering those who want to acquire a lot of data. Additionally, scrapers for Basketball Reference do exist, but none of them load dynamically rendered content. These scrapers can only acquire statically loaded content, preventing those who want statistics in certain formats (for example, Player Advanced Stats Per Game).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file basketball_reference_scraper-1.0.0.tar.gz
.
File metadata
- Download URL: basketball_reference_scraper-1.0.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9125ecc99ce4b6a570aa5b36ee2d579cc417a21f64afd8e98985f7b74f6f934a |
|
MD5 | 996f45647eded8a964c4789e230a4924 |
|
BLAKE2b-256 | 7de4d25538097c3eb2e8e395cd34054b4f071bdf051fb5276ccc780b01d4492d |
File details
Details for the file basketball_reference_scraper-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: basketball_reference_scraper-1.0.0-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01873bdce04d8cdfe19eb81974f415a18c9a487414564d713204e12bdc9df86d |
|
MD5 | 319589464bef7d7e3975d065b9043a97 |
|
BLAKE2b-256 | b2642eae5a4e9490d6b9f3731ab065c9cb1a847ccff9cae133a287e427ba32bf |