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

uoel-sdk

v1.0.4

Published

unofficial sdk for uoel student portal

Readme

UOEL Student Portal SDK

An unofficial, strongly-typed TypeScript SDK for programmatic access to the University of Education, Lahore (UOEL) Student Portal.

This SDK abstracts away the complexities of the portal's authentication flow, CSRF token management, and session handling, providing clean and structured data for a student's profile, grades, and semester records.

Features

  • Robust Authentication: Handles the multi-step login process, including CSRF token extraction and HTTP 403 bypass.
  • Auto-Reauthentication: Automatically detects expired sessions (HTTP 419/401) and re-authenticates behind the scenes.
  • Session Management: Transparently manages session cookies (XSRF-TOKEN, ums_ue_student_portal_session) using an in-memory cookie jar.
  • Structured Data Extraction:
    • Student Profile: Extracts comprehensive details including personal info, academic standing (CGPA, required credits, probation limits), and previous academic history.
    • Semester Data: Retrieves detailed course-wise breakdowns (Mid, Practical, Sessional, Final, Total Score, Grade, Grade Point) along with the semester summary (GPA, Credits Earned, Status).
  • Strongly Typed: Built with TypeScript, providing full intellisense and interface definitions for all scraped data.

Installation

Currently, this SDK is intended to be used locally or compiled as part of a larger project. Ensure you have Node.js and dependencies installed.

npm install
# or
yarn install

Quick Start

import { UOELStudentPortal } from './src/client';
import { SemesterBatchCode } from './src/types';

async function main() {
  const portal = new UOELStudentPortal();

  try {
    // 1. Authenticate with your portal credentials
    console.log('Logging in...');
    await portal.login({
      username: 'your-username', // e.g. bsf...
      password: 'your-password'
    });
    console.log('Login successful!');

    // 2. Fetch the authenticated student's profile
    console.log('Fetching profile...');
    const profile = await portal.getStudentProfile();
    console.log(`Welcome, ${profile.name}! (CGPA: ${profile.cgpa})`);
    console.log('Profile Details:', profile);

    // 3. Fetch data for a specific semester
    console.log('Fetching semester data for Fall 2023...');
    const semesterData = await portal.getSemesterData('2304');
    console.log(`Semester: ${semesterData.semesterName}`);
    console.log(`GPA: ${semesterData.summary.gpa}`);
    console.log('Courses:', semesterData.courses);

  } catch (error) {
    console.error('Error occurred:', error);
  }
}

main();

API Reference

UOELStudentPortal

The main class orchestrating communication with the portal.

login(credentials: LoginCredentials): Promise<void>

Authenticates the user, extracts necessary CSRF tokens, and establishes an active session. Stores credentials internally to allow auto-reauthentication if the session expires during subsequent requests.

getStudentProfile(): Promise<StudentProfile>

Fetches the student profile from /student-profile and parses it into a strongly typed StudentProfile object, including academic history.

getSemesterData(semBatch: SemesterBatchCode): Promise<SemesterDataResponse>

Retrieves course grades and summary information for a given semester batch (e.g., '2304' for Fall 2023).

Data Types (Highlights)

StudentProfile

Contains personal info, ID numbers, CGPA, total credits, required GPA for probation, program details, and an array of AcademicRecord (previous degrees like Matriculation/Intermediate).

SemesterDataResponse

Includes the semesterName (e.g. "Fall 2023"), a summary object (GPA, total courses, credits earned, status), and an array of courses detailing marks breakdown (mid, practical, sessional, final, score, grade, gradePoint).

SemesterBatchCode

A union of supported batch codes corresponding to specific semesters (e.g., '2304' for Fall 2023, '2402' for Spring 2024, etc.).

Error Handling

The SDK exposes specific error classes to help you handle different failure modes gracefully:

  • AuthenticationError: Thrown when invalid credentials are provided.
  • SessionExpiredError: Thrown when the session expires and auto-reauth cannot proceed (e.g., missing stored credentials).
  • ParseError: Thrown when the SDK fails to extract required data from the HTML payload (e.g., if the portal's markup changes).

Disclaimer

This is an unofficial SDK. It relies on web scraping and intercepting XHR requests from the UOEL Student Portal. Changes to the portal's underlying HTML structure or authentication flow may break this SDK. Please use responsibly.