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
Finding your Liga ID
The --ligaid value comes from the liga_id parameter in the DBB league URL:
https://www.basketball-bund.net/index.jsp?Action=103&liga_id=51187
^^^^^
this is your liga ID
Copy the number after liga_id= and pass it to --ligaid.
Quick Start
# Install with uv
uv sync
# Download league data
uv run korb --ligaid 51187 download
# View standings
uv run korb --ligaid 51187 standings
# Download fresh data + predict in one go
uv run korb --ligaid 51187 --download predict
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 --ligaid 12345 download
Saves ergebnisse.html and spielplan.html into files/<ligaid>/.
standings โ League table
uv run korb --ligaid 12345 standings
# 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 --ligaid 12345 team "Thunder"
# With bar chart + quality metrics for last 5 games
uv run korb --ligaid 12345 team "Thunder" --bars --last-k 5 --metrics
schedule โ Game calendar
# All upcoming games
uv run korb --ligaid 12345 schedule --pending
# Filter by team + mark back-to-back โก fixtures
uv run korb --ligaid 12345 schedule --team "Hawks" --pending --b2b
# Include cancelled games
uv run korb --ligaid 12345 schedule --all
predict โ Forecast final standings
uv run korb --ligaid 12345 predict
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 --ligaid 12345 top -n 5
--download โ Fetch fresh data before any command
# Download + show standings in one step
uv run korb --ligaid 12345 --download standings
# Download + predict
uv run korb --ligaid 12345 -d predict
--json โ Machine-readable output
Add --json before any subcommand to get JSON instead of tables:
uv run korb --json --ligaid 12345 standings
uv run korb --json --ligaid 12345 team "Hawks"
uv run korb --json --ligaid 12345 schedule --pending
uv run korb --json --ligaid 12345 predict
uv run korb --json --ligaid 12345 top -n 3
CLI Reference
$ uv run korb --help
usage: korb [-h] [--version] [--results RESULTS] [--schedule SCHEDULE]
[--json] [--ligaid LIGAID] [--download]
{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 standings
download Download results & schedule HTML
options:
-h, --help show this help message and exit
--version, -V show program's version number and exit
--results, -r RESULTS HTML results file path
--schedule, -s SCHEDULE
HTML schedule file path
--json Output as JSON instead of formatted tables
--ligaid, -l LIGAID Liga ID (e.g. 51491)
--download, -d Download latest data before running the command
standings --help
usage: korb standings [-h]
options:
-h, --help show this help message and exit
team --help
usage: korb team [-h] [--bars] [--last-k LAST_K] [--metrics] name
positional arguments:
name Team name (e.g., 'TV 1877 Lauf')
options:
-h, --help show this help message and exit
--bars, -b Show point differential bar chart
--last-k LAST_K Analyze only the most recent K games
--metrics Show win-rate + margin quality metrics
schedule --help
usage: korb schedule [-h] [--all] [--pending] [--team TEAM] [--b2b]
options:
-h, --help show this help message and exit
--all, -a Show cancelled games
--pending, -p Show only pending games
--team, -t TEAM Filter by team name (partial match)
--b2b Mark back-to-back fixtures (โค36h)
predict --help
usage: korb predict [-h]
options:
-h, --help show this help message and exit
top --help
usage: korb top [-h] [-n N]
options:
-h, --help show this help message and exit
-n N How many teams to show (default: 3)
download --help
usage: korb download [-h]
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
--ligaidpaths resolve relative to your current working directory (files/<ligaid>/). Runkorbfrom the project root or pass explicit--results/--schedulepaths.
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.2.1.tar.gz.
File metadata
- Download URL: korb-0.2.1.tar.gz
- Upload date:
- Size: 33.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.5 {"installer":{"name":"uv","version":"0.11.5","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 |
a39125fd2570a3762b6604de87b65a78077eda739fd9cdbaa268aa5abf6aa8d8
|
|
| MD5 |
3904b6828eb6fb73800a4cf2a0974846
|
|
| BLAKE2b-256 |
7a31d8ba58c7727835c951f345ed3910e8804ea658a8266a7c565d9bd6d48819
|
File details
Details for the file korb-0.2.1-py3-none-any.whl.
File metadata
- Download URL: korb-0.2.1-py3-none-any.whl
- Upload date:
- Size: 24.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.5 {"installer":{"name":"uv","version":"0.11.5","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 |
f01739443c9f8aee7e8b16c268577c2b28b3799ec54dd8604ec9f89818ae0953
|
|
| MD5 |
deb31338d6172f297848e06f96e086ab
|
|
| BLAKE2b-256 |
70543da81fc02997873fbb27c052d40ddeaf72e9a0ed3ad22c8ce58401917c37
|