-
-
Notifications
You must be signed in to change notification settings - Fork 0
Methods
Public methods which anyone can access. All public methods are promises.
Create a new instance of the SchoolSoft class. You need a chromium executable. This prepares everything before login.
-
school: string: The name of the school. This can be found as the first part of the path, right after the first/when in SchoolSoft. -
path?: string: The path to the chromium executable. This is optional. The default value is/usr/bin/chromium-browser, but you may change it to whatever you want, as long as it leads to the correct chromium executable.
Returns the SchoolSoft class.
const SchoolSoft = require('schoolsoft-scraper').default;
// or
const { default: SchoolSoft } = require('schoolsoft-scraper');
const school = new SchoolSoft('school');
// or
const school = new SchoolSoft('school', '/path/to/chromium-executable');import SchoolSoft from 'schoolsoft-scraper';
const school = new SchoolSoft('school');
// or
const school = new SchoolSoft('school', '/path/to/chromium-executable');Logs into SchoolSoft. This is required before fetching any data.
-
username: string: The student's username. -
password: string: The student's password.
Returns the redirected URL on success, throws an error on failure.
school.login('sample', 'text')
.then(url => console.log('URL', url))
.catch(console.error);Gets the lunch menu from SchoolSoft.
-
week?: number: Optionally include the week that you want to get the lunch menu for.
Returns the LunchMenu interface on success, throws an error on failure.
school.getLunchMenu()
.then(console.log)
.catch(console.error)
// or
school.getLunchMenu(40/*between 1 and 52*/)
.then(console.log)
.catch(console.error)Gets the current news from SchoolSoft.
None.
Returns the News interface on success, throws error on failure.
school.getNews()
.then(console.log)
.catch(console.error)Gets the upcoming and old assignments from SchoolSoft.
None.
Returns the Assignments interface on success, throws error on failure.
school.getAssignments()
.then(console.log)
.catch(console.error);Gets new and old assignment results from SchoolSoft.
None.
Returns the Results interface on success, throw error on failure.
school.getResults()
.then(console.log)
.catch(console.error);Gets the weekly planning for each subject which has one from SchoolSoft.
None.
Returns the WeeklyPlanning interface on success, throws error on failure.
school.getWeeklyPlanning()
.then(console.log)
.catch(console.error)Logs out of SchoolSoft.
None.
Returns true on successfully logging out, returns false or throws error on failure.
school.logout()
.then(bool => console.log('Logged out', bool))
.catch(console.error)Closes the chromium instance.
None.
Returns true on success, throws error on failure.
school.close()
.then(bool => console.log('Closed', bool))
.catch(console.error);Private methods which only the class can access. All private methods are promises.
Opens the chromium instance.
None.
Returns true on success, returns false on failure.
school.close();Checks to see if the user has successfully logged in via the <SchoolSoft>.login() method.
None.
Returns true if the user is logged in, throws error on not logged in.
school.isLoggedIn()
.then(bool => console.log('is logged in', bool))
.catch(console.error);Fetches the lunch menu from a page.
None.
Returns the LunchMenu interface on success, throws error on failure.
school.fetchLunchMenu()
.then(console.log)
.catch(console.error);