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 data commands (not download)

Installation

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

# With pip (end-user install)
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)

Data Notes

  • DBB encodes forfeits as 20:0 / 0:20; korb counts them as completed games, awards the winner 2 points, and deducts 1 point from the loser.
  • Struck-through and cancelled rows are skipped.

Project Structure

korb/
├── __init__.py      # Package marker & version
├── __main__.py      # CLI entry point & command handlers
├── core.py          # Shared models, HTML parsing, utilities
├── download.py      # HTTP downloader, headers, rate limiting
├── 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 --locked

# Lint, format & type-check
uv run ruff check korb/ tests/
uv run ruff format korb/ tests/
uv run basedpyright korb

# Run tests
uv run pytest

Project conventions are documented in docs/coding-standard.md.

License

MIT

Metadata

Release files for korb 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for korb 0.3.1
File Size Uploaded Provenance Actions
korb-0.3.1.tar.gz 79.7 kB Without provenance Details for korb-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for korb 0.3.1
File Interpreter ABI Platform Actions
korb-0.3.1-py3-none-any.whl Python 3 none any Details for korb-0.3.1-py3-none-any.whl

Total release size: 107.9 kB

Release files / korb-0.3.1.tar.gz

Download URL korb-0.3.1.tar.gz
Size 79.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a06c11e1d2adf29e0926b36a3dca02f1ab0ebc58c7a07165fffcd0e2b919b06f
BLAKE2b-256 checksum
How to use checksums
27d804deb8da64cd1b9861896353d4eb39786a1e3feae7075cc2ec882a74bde0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / korb-0.3.1-py3-none-any.whl

Download URL korb-0.3.1-py3-none-any.whl
Size 28.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6f7ec77521d11becea510fa9659542b4d1db9b43b77bc5eee6c4671fd781e6c6
BLAKE2b-256 checksum
How to use checksums
9632a71091cef31d8da52e5905cac9216f8ebf2706321c7fd35b9bcc27169f1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for korb 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page