Repository for the BackCourt | NBA Stats & News Api
This project is a FastAPI-based web scraping API designed to collect and provide advanced basketball statistics from various online sources. The API fetches articles and data related to basketball using web scraping techniques, processes the extracted information, and serves it through RESTful endpoints. Also, it uses the nba_api retrieve official NBA statistics.
- Fetches basketball-related articles from multiple websites
- Extracts relevant data using BeautifulSoup
- Provides endpoints to access filtered and categorized statistics
- Optimized for performance with FastAPI and asynchronous requests
- Supports query parameters to filter data by team, player, source, etc.
First, you need to create a virtual environment:
python -m venv venv
or
python3 -m venv venvThen, active it:
# Windows (cmd)
venv\Scripts\activate
# Linux/macOS (bash)
source venv/bin/activateAfter setting up the environment, install the dependencies:
You can install the dependencies using the requerements.txt file:
pip install -r requirements.txtor install directly using:
pip install fastapi uvicorn requests beautifulsoup4 numpy pandas nba_apiuvicorn app.main:app --reload- Every new endpoint is automatically added to the documentation.
- You can access the documentation to learn how to use it:
http://localhost:8000/docsThe application is deployed on Railway, a cloud platform that simplifies backend and API hosting.
You can access the live API at:
https://backcourt-api-production.up.railway.app
⚠️ Please use responsibly to avoid exceeding the free-tier usage limits.
- This repository has no commercial or business intentions
- All rights are reserved to the NBA.
- Check the Terms of Use to learn about the usage of the data.