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.1.tar.gz
.
File metadata
- Download URL: basketball_reference_scraper-1.0.1.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 | f3fa159a2a15ab5a69cd82b8308fd18604534adccae63a25f3a3ae191cdec913 |
|
MD5 | 221e551efdc56393851554a1eaba798c |
|
BLAKE2b-256 | d064cda10814d9b85efbc93f1300b7858563d121b4e8382f5be98aaff1abd35f |
File details
Details for the file basketball_reference_scraper-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: basketball_reference_scraper-1.0.1-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 | 03ee5d0fe2d39fa03735adca8ce4910c851f6519e13d12713a35d5baea6953d9 |
|
MD5 | 5583783724ebe7b76afb234f799317a5 |
|
BLAKE2b-256 | efcc66ef99ab219070378719d65d2028bb9a8d4f9619119836484e484fc74c2d |