New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

websoc-api

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

websoc-api

A small library to retrieve course data by scraping UCI's schedule of classes system

latest
npmnpm
Version
3.0.0
Version published
Weekly downloads
18
-77.78%
Maintainers
2
Weekly downloads
 
Created
Source

Introduction

A nodejs module to access listings from UCI's schedule of classes, WebSoc. This API allows access to school, department, course, and section data in a hierarchical JSON format.

Installation

Requires NodeJS 12

$ npm install --save websoc-api

Documentation

Retrieving class listings

async callWebSocAPI(options)

To retrieve class listings, you just call the function you imported, callWebSocAPI and pass in an object-literal that configures what you're looking for, such as department, term, division etc.

options

Descriptions found here

NameFormattingNotes
term[Year] ['Fall'|'Winter'|'Spring'|'Summer1'|'Summer2'|'Summer10wk']
Example: '2017 Fall'
Default: ' '
Required. Schedule for your selected term must be available on WebSoc.
ge['ANY'|'GE-1A'|'GE-1B'|'GE-2'|'GE-3'|'GE-4'|'GE-5A'|'GE-5B'|'GE-6'|'GE-7'|'GE-8']
Example: 'GE-1B'
Default: ' '
Must specify at least one of department, GE, courseCodes, or instructorName
departmentList of available departments to search available in file depts.txt
Example: 'I&C SCI'
Default: ' '
Must specify at least one of department, GE, courseCodes, or instructorName
courseNumberAny valid course number or range
Example: '32A' OR '31-33'
Default: ' '
division['ALL'|'LowerDiv'|'UpperDiv'|'Graduate']
Example: 'LowerDiv'
Default: 'ALL'
sectionCodesAny valid 5-digit course code or range
Example: "36531" OR "36520-36536"
Default: ' '
Must specify at least one of department, GE, courseCodes, or instructorName
instructorNameAny valid instructor last name or part of last name
Example: 'Thornton'
Default: ' '
Enter last name only
courseTitleAny text
Example: 'Intro'
Default: ' '
sectionType['ALL'|'ACT'|'COL'|'DIS'|'FLD'|'LAB'|'LEC'|'QIZ'|'RES'|'SEM'|'STU'|'TAP'|'TUT']
Example: 'LAB'
Default: 'ALL'
unitsAny integer or decimal with only tenths place precision, or 'VAR' to look for variable unit classes only.
Example: '5' OR '1.3'
Default: ' '
days['M'|'T'|'W'|'Th'|'F'] or a combination of these days
Example: 'T' OR 'MWF'
Default: ' '
startTimeAny time in 12 hour format
Example: '10:00AM' OR '5:00PM'
Default: ' '
Only enter sharp hours
endTimeAny time in 12 hour format
Example: '12:00AM' OR '6:00PM'
Default: ' '
Only enter sharp hours
maxCapacityExact number like '300' or modified with '<' or '>' to indicate less than specified or greater than specified.
Example: '>256' OR '19' OR '<19'
Default: ' '
fullCourses['ANY'|'SkipFullWaitlist'|'FullOnly'|'OverEnrolled']
'SkipFullWaitlist' means that full courses will be included if there's space on the wait-list
'FullOnly' means only full courses will be retrieved
'OverEnrolled' means only over-enrolled courses will be retrieved
Example:'SkipFullWaitlist'
Default: 'ANY'
cancelledCourses['Exclude'|'Include'|'Only']
Example: 'Include'
Default: 'EXCLUDE'
buildingAny valid building code
Example: 'DBH'
Default: ' '
The value is a building code. Building codes found here: https://www.reg.uci.edu/addl/campus/
roomAny valid room number
Example: '223'
Default: ' '
You must specify a building code if you specify a room number

Usage

// Import the module
import { callWebSocAPI } from 'websoc-api';

//Specify our search parameters
const opts = {
    term: '2019 Fall',
    GE: 'GE-2',
    instructorName: 'Pattis'
}

// Call the module, and when the promise resolves, print out the JSON returned
const result = await callWebSocAPI(opts);
console.log(output);

Using retrieved data

The API serves its data in a hierarchical manner. The top level object is schools. Each school in the array contains departments, which contains courses, which contain sections.

School

FieldTypeNotes
schoolNamestringThe name of the school like 'Donald Bren School of Information and Computer Science'
schoolCommentstring
departmentsarray of Department objects

Department

FieldTypeNotes
deptNamestringThe name of the department like 'Informatics'.
deptCodestringThe code of the department like 'IN4MATX'.
deptCommentstringComments that the department put on WebSoc.
coursesarray of Course objects
sectionCodeRangeCommentsarrayComments associated with a range of sections.
courseNumberRangeCommentsarrayComments associated with a range of courses.

Course

FieldTypeNotes
courseNumberstringCourse number, like '33'.
courseTitlestringCourse title, like 'INTERMEDIATE PRGRMG'.
courseCommentstring
prerequisiteLinkstringLink to the registrar's page where prerequistes are listed
sectionsarray of Section objects

Section

FieldTypeNotes
sectionCodestring
sectionTypestring
sectionNumstring
unitsstring
instructorsarray
meetingsarray of objects with fields "days", "time" and "bldg"If the meeting is "TBA", the field "days" will be "TBA" and the others will be empty strings.
finalExamstring
maxCapacitystring
numCurrentlyEnrolledobject with fields "totalEnrolled" and "sectionEnrolled"When a course is crosslisted, it will have both fields filled, otherwise, "sectionEnrolled" will be an empty string.
numOnWaitliststring
numRequestedstring
numNewOnlyReservedstring
restrictionsstringThe restriction code definitions can be found here
statusstring
sectionCommentstring

FAQs

Package last updated on 28 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts