This package has been deprecated

Author message:

Please use @mtucourses/scrapper instead.

mtu-courses
TypeScript icon, indicating that this package has built-in type declarations

0.1.2Ā ā€¢Ā PublicĀ ā€¢Ā Published

šŸ› mtu-courses

Scrape all courses for a given semester from Michigan Tech's website.

Install

npm i mtu-courses

Quickstart

constĀ CoursesĀ =Ā require('mtu-courses');
Ā 
(asyncĀ ()Ā =>Ā {
Ā Ā constĀ mtuĀ =Ā newĀ Courses();
Ā 
Ā Ā awaitĀ mtu.load();
Ā 
Ā Ā //Ā GetĀ allĀ meetingĀ datesĀ forĀ firstĀ loadedĀ course
Ā Ā console.log(mtu.courses.find(courseĀ =>Ā course.startDateĀ !==Ā undefined).getMeetingDates());
Ā 
Ā Ā constĀ totalFeeĀ =Ā mtu.courses.filter(courseĀ =>Ā course.online).reduce((accum,Ā course)Ā =>Ā accumĀ +Ā course.fee,Ā 0);
Ā 
Ā Ā console.log(`ItĀ wouldĀ costĀ anĀ extraĀ $${totalFeeĀ /Ā 100}Ā toĀ takeĀ allĀ offeredĀ onlineĀ coursesĀ thisĀ semester.`);
})();

(Note that the Michigan Tech website/database system is quite slow and it takes around 13-15 seconds for await mtu.load() to complete.)

All dates/times are in UTC.

Fees are in cents instead of dollars to be consistent with the way financal data is usually handled in code.

šŸ“š Docs

Hosted on Github Pages.

Package Sidebar

Install

npm i mtu-courses

Weekly Downloads

0

Version

0.1.2

License

MIT

Unpacked Size

15.1 kB

Total Files

11

Last publish

Collaborators

  • codetheweb