Skip to main content

🏀 korb
A CLI toolkit for DBB basketball league analysis

Python 3.10+ Zero dependencies MIT License


korb is a zero-dependency Python CLI that parses HTML from the DBB (Deutscher Basketball Bund) legacy JSP platform and provides standings, results, schedules, predictions, and more.

Features

  • 📊 Standings — full league table with points, differentials, averages
  • 🏀 Team — game-by-game results, sparklines, quality metrics
  • 📋 Ergebnisse — all completed game results with optional team filter
  • 📅 Schedule — with back-to-back detection, filtering, pending games
  • 🔮 Predict — efficiency-model-based final standings forecast
  • 🥇 Top — quick leaderboard with ASCII bar chart
  • 📥 Download — fetch fresh HTML data directly from basketball-bund.net
  • 🔧 --json — machine-readable output for all commands

Installation

# With uv (recommended)
git clone https://github.com/malvavisc0/korb && cd korb
uv sync

# With pip
pip install .

After installation, the korb CLI is available inside the virtual environment. Use uv run korb to invoke it, or activate the venv first.

Quick Start

# 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

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

Commands

download — Fetch HTML data

uv run korb --ligaid 12345 download
uv run korb download --all   # refresh all previously downloaded leagues

Saves ergebnisse.html and spielplan.html into files/<ligaid>/.

standings — League table

uv run korb --ligaid 12345 standings

ergebnisse — Game results

uv run korb --ligaid 12345 ergebnisse
uv run korb --ligaid 12345 ergebnisse --team "Hawks"

team — Deep dive on a single team

uv run korb --ligaid 12345 team "Thunder"
uv run korb --ligaid 12345 team "Thunder" --bars --last-k 5 --metrics

schedule — Game calendar

uv run korb --ligaid 12345 schedule --pending
uv run korb --ligaid 12345 schedule --team "Hawks" --pending --b2b

predict — Forecast final standings

uv run korb --ligaid 12345 predict

top — Quick leaderboard

uv run korb --ligaid 12345 top -n 5

Global flags

Flag Description
--json Output as JSON instead of formatted tables
--download, -d Fetch fresh data before running the command
--ligaid, -l Liga ID (resolves file paths automatically)
--results, -r Explicit path to HTML results file
--schedule, -s Explicit path to HTML schedule file
--version, -V Show version

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)

Project Structure

korb/
├── __init__.py      # Package marker & version
├── __main__.py      # CLI entry point & download command
├── core.py          # Shared models, HTML parsing, utilities
├── ergebnisse.py    # Game results viewer & filter
├── predict.py       # Multiplicative efficiency prediction model
├── schedule.py      # HTML schedule parser & filters
├── standings.py     # Standings calculator
└── team.py          # Team results viewer & metrics

Requirements: Python 3.10+ · uv · No runtime dependencies

Note: Downloaded HTML files and --ligaid paths resolve relative to your current working directory (files/<ligaid>/). Run korb from the project root or pass explicit --results / --schedule paths.

Development

# Install with dev tools
uv sync --group dev

# Lint & format
uv run ruff check korb/ tests/
uv run ruff format korb/ tests/

# Run tests
uv run pytest

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

korb-0.2.9.tar.gz (32.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

korb-0.2.9-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file korb-0.2.9.tar.gz.

File metadata

  • Download URL: korb-0.2.9.tar.gz
  • Upload date:
  • Size: 32.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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

Hashes for korb-0.2.9.tar.gz
Algorithm Hash digest
SHA256 fb9377aa02a591de73462f19ad58d73101fa2785423fd578bdf857ffa67d6e5d
MD5 0328b0b409643f3d25bcc1e7dfdc481d
BLAKE2b-256 1045f11cde19000ed4231b12f251cf8a762ec3028146ff3a748aa6d66837ef02

See more details on using hashes here.

File details

Details for the file korb-0.2.9-py3-none-any.whl.

File metadata

  • Download URL: korb-0.2.9-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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

Hashes for korb-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 546edd09260c2b9443d4342c44d438f5b65bbf60dc6b2b1be1a46e5646c22ff5
MD5 67096356a16e7f306cbcc5f249fc984c
BLAKE2b-256 6f7621d1b0f1624f71822e9f753c74226f6b9af16f21164c805eb1a85e7695ac

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.9 This release

2 files

0.2.8

2 files

0.2.7

2 files

0.2.6

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page