A CLI toolkit for DBB basketball league analysis
Project description
๐ korb
A CLI toolkit for DBB basketball league analysis
What is this?
A zero-dependency Python CLI that parses HTML from the DBB (Deutscher Basketball Bund) legacy JSP platform and gives you:
- ๐ Standings โ full league table with points, differentials, averages
- ๐ Team drill-down โ game-by-game results, sparklines, quality metrics
- ๐ Schedule โ with back-to-back detection, filtering, pending games
- ๐ฎ Predictions โ efficiency-model-based final standings forecast
- ๐ฅ Top N โ quick leaderboard with ASCII bar chart
- ๐ฅ Download โ fetch fresh HTML data directly from basketball-bund.net
- ๐ง JSON output โ pipe-friendly
--jsonflag for all commands
Quick Start
# Install with uv
uv sync
# Download league data (liga_id from the DBB URL)
uv run korb download 12345
# View standings
uv run korb standings --liganr 12345
# Predict the rest of the season
uv run korb predict --liganr 12345
Installation
# Clone and install
git clone https://github.com/malvavisc0/korb && cd korb
uv sync
# Install with dev tools (black, isort)
uv sync --group dev
After uv sync, the korb CLI is available inside the virtual environment. Use uv run korb to invoke it, or activate the venv with source .venv/bin/activate and run korb directly.
Commands
download โ Fetch HTML data
# Download results + schedule for a league
uv run korb download 12345
Saves ergebnisse.html and spielplan.html into files/<liganr>/.
standings โ League table
uv run korb standings --liganr 12345
# Team GP W L D PF PA Diff Pts Avg PF Avg PA
----------------------------------------------------------------------------------
1 Thunder Academy 12 9 3 0 1248 847 +401 18 104.0 70.6
2 Riverside Hawks 11 9 2 0 952 668 +284 18 86.5 60.7
3 Metro Wolves 11 8 3 0 813 694 +119 16 73.9 63.1
...
team โ Deep dive on a single team
# Basic results
uv run korb team "Thunder" --liganr 12345
# With bar chart + quality metrics for last 5 games
uv run korb team "Thunder" --bars --last-k 5 --metrics --liganr 12345
schedule โ Game calendar
# All upcoming games
uv run korb schedule --pending --liganr 12345
# Filter by team + mark back-to-back โก fixtures
uv run korb schedule --team "Hawks" --pending --b2b --liganr 12345
# Include cancelled games
uv run korb schedule --all --liganr 12345
predict โ Forecast final standings
uv run korb predict --liganr 12345
Uses a multiplicative efficiency model with recency weighting, recent form blending, home advantage, and back-to-back fatigue modelling.
top โ Quick leaderboard
uv run korb top -n 5 --liganr 12345
--json โ Machine-readable output
Add --json before any subcommand to get JSON instead of tables:
uv run korb --json standings --liganr 12345
uv run korb --json team "Hawks" --liganr 12345
uv run korb --json schedule --pending --liganr 12345
uv run korb --json predict --liganr 12345
uv run korb --json top -n 3 --liganr 12345
CLI Reference
$ uv run korb --help
usage: korb [-h] [--results RESULTS] [--json]
{standings,team,schedule,predict,top,download} ...
Basketball league analysis tools
positional arguments:
{standings,team,schedule,predict,top,download}
standings Display league standings
team Display results for a team
schedule Display game schedule
predict Predict final standings
top Show top teams from current standings
download Download results & schedule HTML
options:
-h, --help show this help message and exit
--results, -r RESULTS
HTML results file path (files/<liganr>/ergebnisse.html)
--json Output as JSON instead of formatted tables
standings --help
usage: korb standings [-h] [--liganr LIGANR]
options:
-h, --help show this help message and exit
--liganr LIGANR Liga ID; uses files/<liganr>/ergebnisse.html
team --help
usage: korb team [-h] [--liganr LIGANR] [--bars] [--last-k LAST_K] [--metrics] name
positional arguments:
name Team name (e.g., 'Thunder Academy')
options:
-h, --help show this help message and exit
--liganr LIGANR Liga ID; uses files/<liganr>/ergebnisse.html
--bars, -b Show point differential bar chart
--last-k LAST_K Analyze only the most recent K games (newest-first)
--metrics Show win-rate + margin quality metrics (respects --last-k)
schedule --help
usage: korb schedule [-h] [--html HTML] [--liganr LIGANR] [--all] [--pending] [--team TEAM] [--b2b]
options:
-h, --help show this help message and exit
--html HTML Schedule HTML file (files/<liganr>/spielplan.html)
--liganr LIGANR Liga ID; uses files/<liganr>/spielplan.html
--all, -a Show cancelled games
--pending, -p Show only pending games
--team, -t TEAM Filter by team name (partial match)
--b2b Mark fixtures that include a back-to-back (โค36h)
predict --help
usage: korb predict [-h] [--html HTML] [--liganr LIGANR]
options:
-h, --help show this help message and exit
--html HTML Schedule HTML file (files/<liganr>/spielplan.html)
--liganr LIGANR Liga ID; uses files/<liganr>/ergebnisse.html + spielplan.html
top --help
usage: korb top [-h] [-n N] [--liganr LIGANR]
options:
-h, --help show this help message and exit
--liganr LIGANR Liga ID; uses files/<liganr>/ergebnisse.html
-n N How many teams to show (default: 3)
download --help
usage: korb download [-h] liganr
positional arguments:
liganr Liga ID (e.g. 12345)
options:
-h, --help show this help message and exit
How Predictions Work
The predict command estimates final standings using a multiplicative efficiency model:
| Factor | How it works |
|---|---|
| Offensive rating | Team's scored points vs. league average (>1.0 = above avg) |
| Defensive rating | Points allowed vs. league average (>1.0 = worse defense) |
| Recency weighting | 60-day half-life โ recent games count more |
| Recent form | Last 5 games blended at 30% weight into ratings |
| Home advantage | 3% scoring boost applied symmetrically |
| B2B fatigue | โค36h between games โ 5% offense/defense penalty |
| New teams | <3 games โ ratings blended toward league average |
| No draws | Ties broken by home advantage (basketball has OT) |
| No double-counting | Already-played games excluded from schedule scan |
๐ง Skills
The skills/ directory contains reusable AI skill definitions โ structured prompts that can be loaded by an AI assistant (e.g. Roo/Cline) to run analysis workflows using the CLI.
| Skill | Output | Description |
|---|---|---|
SKILL_TEAM_ANALYSIS.md |
Paragraph | Short team summary (position, identity, form, outlook) โ ready for a webpage card |
SKILL_LEAGUE_TOP_N_ANALYSIS.md |
Table + paragraph | Predicted final standings table with a brief explanation |
Both skills accept a LANGUAGE parameter (en/de/es) and return output directly (no file saved). To use a skill, point your AI assistant at the markdown file or load it as a skill definition.
Project Structure
โโโ korb/
โ โโโ __init__.py # Package marker
โ โโโ __main__.py # CLI entry point & download command
โ โโโ core.py # Shared models, HTML parsing, utilities
โ โโโ predict.py # Multiplicative efficiency prediction model
โ โโโ schedule.py # HTML schedule parser & filters
โ โโโ standings.py # Standings calculator
โ โโโ team.py # Team results viewer & metrics
โโโ skills/ # AI skill definitions for automated analysis
โโโ files/ # Downloaded HTML data (git-ignored)
โโโ tests/ # Tests
โโโ pyproject.toml # Project metadata & uv config
โโโ README.md
Requirements: Python 3.10+ ยท uv ยท No runtime dependencies
Note: Downloaded HTML files and
--liganrpaths resolve relative to your current working directory (files/<liganr>/). Runkorbfrom the project root or pass explicit--results/--htmlpaths.
Dev tools
# Format code
uv run black korb/
# Sort imports
uv run isort korb/
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file korb-0.1.0.tar.gz.
File metadata
- Download URL: korb-0.1.0.tar.gz
- Upload date:
- Size: 30.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.4 {"installer":{"name":"uv","version":"0.11.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
180849e55b71dd44cfae014de37eab5fc24f38ed94c9d69ccb42468eeab7d776
|
|
| MD5 |
f867fd871d6d40d55b39d3426ac43a14
|
|
| BLAKE2b-256 |
a17b3b78054f7fc6ee4af8726de21eaa04bc438285097ce7367ab8164a3f4c6f
|
File details
Details for the file korb-0.1.0-py3-none-any.whl.
File metadata
- Download URL: korb-0.1.0-py3-none-any.whl
- Upload date:
- Size: 23.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.4 {"installer":{"name":"uv","version":"0.11.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5f79d769598282251af3e51f2253c15d7941f8a4d6505911284d0bbbf7ffdf7
|
|
| MD5 |
5b8e44e93f232a39d7d2dd24fdbdc08c
|
|
| BLAKE2b-256 |
531c31fa6c719af0783a81c1a410dd9170958c14ffb967ce134f34ec306834d9
|