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

@studentsphere/ots-provider-example

v1.0.0

Published

Example implementation of a Open Timetable Scrapper Provider

Readme

An example implementation of an Open Timetable Scraper (OTS)

This package serves as a reference and a template for developers who want to build their own timetable scraper providers. It implements a mock provider.

Installation

npm install @studentsphere/ots-provider-example

How to create your own Provider

Creating a custom provider for StudentSphere is straightforward. All providers must extend the BaseTimetableProvider class from the @studentsphere/ots-core package.

Here is a step-by-step guide to building your own provider.

1. Install the core library

First, you need to install the core package which contains the base class and TypeScript interfaces:

npm install @studentsphere/ots-core

2. Create your Provider class

Create a new TypeScript file and extend the BaseTimetableProvider. You will need to implement several getters and two main asynchronous methods: validateCredentials and getSchedule.

import {
  BaseTimetableProvider,
  type Course,
  type ProviderCredentials,
  type School,
} from "@studentsphere/ots-core";

export class MyCustomProvider extends BaseTimetableProvider {
  // 1. Define provider metadata
  get id(): string {
    return "my-custom-provider"; // A unique identifier for your provider
  }

  get name(): string {
    return "My Custom Provider"; // The display name
  }

  get logo(): string {
    return "https://example.com/logo.png"; // URL to the provider's logo
  }

  // 2. OPTIONAL: Define supported schools/campuses
  get schools(): School[] {
    return [
      {
        id: "campus-paris",
        name: "Paris Campus",
        logo: "https://example.com/paris.png",
      },
    ];
  }

  // 3. Implement authentication logic
  async validateCredentials(
    credentials: ProviderCredentials
  ): Promise<boolean> {
    try {
      // TODO: Implement your login logic here (e.g., using fetch, axios, or puppeteer)
      // Example:
      // const response = await loginToSchoolPortal(credentials.identifier, credentials.password);
      // return response.isSuccessful;
      
      return credentials.identifier === "student" && credentials.password === "password123";
    } catch (error) {
      return false;
    }
  }

  // 4. Implement scraping logic
  async getSchedule(
    credentials: ProviderCredentials,
    from: Date,
    to: Date
  ): Promise<Course[]> {
    // TODO: Fetch the timetable from the school's portal for the given date range
    // and map the results to the `Course` interface.
    
    const courses: Course[] = [];

    // Example of a mapped course:
    courses.push({
      hash: "unique-course-id-123", // A unique hash to identify this specific course
      subject: "Mathematics",
      start: new Date("2023-10-01T08:00:00"),
      end: new Date("2023-10-01T10:00:00"),
      location: "Room 101",
      teacher: "John Doe",
      color: "#3b82f6", // Optional: Hex color code
    });

    return courses;
  }
}

3. Method Breakdown

  • id: A unique string identifying your provider (e.g., provider-wigor, provider-celcat).
  • name: The human-readable name of the provider.
  • logo: A URL pointing to the provider's logo.
  • schools: An array of School objects. Some providers handle multiple schools or campuses. If your provider only handles one, just return an array with a single object.
  • validateCredentials(credentials): This method should attempt to log in to the school's portal using the provided identifier and password. It must return true if the credentials are valid, and false otherwise.
  • getSchedule(credentials, from, to): This is the core of your provider. It must fetch the timetable data between the from and to dates, parse it, and return an array of Course objects.

License

MIT