npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

zhs-client-js

v1.0.4

Published

ZHS Client zum buchen von freies-Spiel Kursen

Readme

zhs-client-js

Kleine Node.js-Library, um ausgewählte ZHS München Sportkurse (z.B. freies Volleyball) zu buchen bzw. in den Warenkorb zu legen.
Die Library nutzt deine bestehenden Login-Cookies und kommuniziert direkt mit der internen GraphQL-API von kurse.zhs-muenchen.de.

⚠️ Inoffizielles Projekt. Keine Verbindung zum ZHS. Nutzung auf eigene Verantwortung.


Features

  • ✔️ Kurse direkt über die interne GraphQL-API reservieren
    (Add-to-Cart / Reservierung)

  • ✔️ Unterstützte Kurse (bisher):
    Volleyball (Slot-basiert)

    • Volleyball – Freies Spiel Montag
    • Volleyball – Freies Spiel Donnerstag
    • Volleyball – Freies Spiel Samstag

    Badminton (Slot-basiert)

    • Badminton – Freies Spiel Donnerstag
    • Badminton – Freies Spiel Freitag
    • Badminton – Freies Spiel Samstag

    Basketball (Slot-basiert)

    • Basketball – Freies Spiel Mittwoch
    • Basketball – Freies Spiel Donnerstag

    Tischtennis (Slot-basiert)

    • Tischtennis – Freies Spiel Samstag

    Nicht slot-basierte Kurse

    • Outdoor-Fitnessanlage – Freies Training
    • Golf – Freies Spiel
  • ✔️ Wochenslot-Kurse automatisch berechnen
    → nächster Termin + optionalem Wochenoffset
    (z.B. übernächster Donnerstag)

  • ✔️ Flexible Authentifizierung über Cookies
    (JSON-Datei, Objekt oder fertiger Cookie-Header)

  • Checkout (Bezahlung) aktuell nicht implementiert
    (muss manuell im Browser erfolgen)


⚠️ Hinweis / Exploit: Volleyball-Kurse unabhängig vom Buchungszeitraum buchen

Die Library erlaubt es, z.B Volleyball-Wochenslotkurse bereits vor dem offiziellen Buchungsstart zu reservieren.

➡️ Dadurch entsteht ein kleiner Exploit, der dir ermöglicht, Volleyball-Slots frühzeitig zu sichern.

⚠️ Nutzung auf eigene Verantwortung


Installation

npm install

Das Projekt nutzt ES-Module ("type": "module").
Node.js 18+ wird empfohlen, da hier fetch global verfügbar ist.

Wenn du das Package als Dependency in einem anderen Projekt verwenden willst:

npm install zhs-client-js

Cookies vorbereiten

Um Anfragen an die ZHS-API zu authentifizieren, benötigst du deine Login-Cookies.
Im Ordner example/ findest du eine Vorlage: foo.cookies.json.

Beispiel:

{
  "name": "foo",
  "cookie": {
    "acceptedCookies": true,
    "csrf_token_xxx": "...",
    "ory-session": "...",
    "payment": "...",
    "rl_anonymous_id": "...",
    "rl_page_init_referrer": "...",
    "rl_page_init_referring_domain": "...",
    "rl_session": "...",
    "rl_user_id": "..."
  }
}

Wichtig:
Diese Datei enthält deine Session → niemals committen oder teilen!


Schnellstart (Beispiel: Volleyball buchen)

Im example-Ordner liegt volleyball.js:

import { ZHSClient } from "../index.js";

const client = ZHSClient.fromCookieFile("./foo.cookies.json");

// Nächsten Donnerstag buchen
const result = await client.book("Volleyball - Freies Spiel Donnerstag");
console.log(result);

// Übernächsten Donnerstag (Offset = 1)
const result2 = await client.book("Volleyball - Freies Spiel Donnerstag", 1);
console.log(result2);

// Checkout muss später manuell im Browser erfolgen

API

Import

Alles wird über index.js bereitgestellt:

import {
  ZHSClient,
  courses,
  getNextDayDate,
  offsetWeek
} from "zhs-client-js";

ZHSClient

Der zentrale Einstiegspunkt.

Client erstellen

// 1) Aus Cookie-Datei
const client = ZHSClient.fromCookieFile("./foo.cookies.json");

// 2) Aus Cookie-Objekt
const client2 = ZHSClient.fromCookieObject({
  name: "foo",
  cookie: { /* ... */ }
});

// 3) Aus Cookie-Header-String
const client3 = ZHSClient.fromCookieString("ory-session=...; rl_session=...;");

Intern wird das Cookie-Objekt in einen String wie
key=value; key2=value2; ...
umgewandelt.


book(courseNameOrId, offset = 0)

Legt den gewünschten Kurs in den Warenkorb.

const result = await client.book("Volleyball - Freies Spiel Samstag");

Parameter:

  • courseNameOrId
    Kursname aus courses oder die ZHS-Kurs-ID
    (IDs werden automatisch zugeordnet)

  • offset
    Wochenversatz (z.B. 1 = nächste Woche)
    Berechnung über getNextDayDate() + offsetWeek().

Ergebnis:

{
  status: "booked" | "not_booked" | "error",
  response,
  responseBody
}
  • "error" → HTTP-Fehler
  • "not_booked" → API antwortet ohne data
  • "booked" → erfolgreiche Reservierung

📌 getCourseSlotDetails(courseName, offset = 0)

Fragt freie Plätze & Buchungsfenster des Kurses ab.

'''js const info = await client.getCourseSlotDetails("Badminton - Freies Spiel Samstag", 1); console.log(info); '''


courses

Enthält Mapping aller unterstützten Kurse:

import { courses } from "zhs-client-js";

console.log(Object.keys(courses));

Jeder Kurs besitzt:

  • id – interne ZHS-Kurs-ID
  • queryString(offset) – erzeugt dynamische GraphQL-Requests

Bei Volleyball basiert der Termin auf dynamischer Wochentagsberechnung.


Helper-Funktionen

Aus helper.js:

  • generateCookieString(obj) – erzeugt Cookie-Header
  • loadJsonFile(path) – lädt JSON synchron
  • getNextDayDate(day) – nächsten bestimmten Wochentag bestimmen
  • offsetWeekday(day, offset) – Wochentag verschieben
  • offsetWeek(date, offset) – Datum um X Wochen verschieben

Sicherheit & Verantwortung

  • Nutze das Tool nur für dein eigenes Konto.
  • Cookies niemals teilen.
  • Exploit nicht übertreiben.
  • Beachte die Nutzungsbedingungen des ZHS.

readme.md erstellt durch ChatGPT5.1