sidpagariya / MProjects

Some projects for University of Michigan Stuff!
schedulemaker-git-master.sidpagariya.vercel.app
MIT License
5 stars 5 forks source link

Feature/detect-term #9

Closed amalbansode closed 5 years ago

amalbansode commented 5 years ago

I noticed that the script currently scrapes the CG for Fall 2018 without a check for the most recent/current term. This should solve that issue by adding a function to modify the URL to point to the current term.

Upon inspection of the CG, I found that each term is given an ID-like string. This "ID" is passed as a query when retrieving a certain webpage in the CG.

So,

I'm not sure about how exactly this ID is computed else I would have taken that route. Instead, I found that some buttons on the main CG page have attributes that contain this ID.

I used bs4 to parse the main CG page and find the element containing the term ID. Then, using some regex matching, the term ID is retrieved and passed to the function that constructs the URL to be parsed.

I modified the URL-constructing function to accommodate for this change.

All-in-all, this should future-proof your script. :)

sidpagariya commented 5 years ago

Hey Amal, thanks for the PR!! I can finally take a look and merge haha!