Automate the process of checking courses with Open Seats in Stony Brook University and sending the updated information messages to whatsapp if open seats are available for your selected course list.
The project doen't use any vulnerabilities, it just uses your credentials in your own browser and uses selenium to navigate to 'https://stonybrook.collegescheduler.com' page and uses the API to send notifications to WhatsApp.
It just automates the process instead of manual login and navigating to the end each time and making your job simpler.
It doesn't store any of your data, they are stored in your browser and in cookies which get reset after some time.
- Install chrome browser
- Login into solar with your details and authenticate in duo to keep it active for few days.
- Login into WhatsApp Web in chrome browser.
- Create an environment(I prefer with Anaconda) and install jupyter notebook if not present.
- Download the jupyter notebook file from this repo and follow the below steps:
- Install the below libraries (Present in Cell 1 of notebook)
# Install these libraries
!pip install selenium
!pip install pywhatkit
!pip install pyautogui
!pip install keyboard
- Replace all the below thimgs with your respective details (Present in Cell 3 of notebook)
# Replace with the course of your choice in capital letters - string format.
#Eg: course="CSE" or course="AMS", or others, etc.
course="CSE"
# Replace with the course subject id's you want to track - list of string format.
#Eg: interested_courses=['508','564','551', '527']
interested_courses=['508','564','551']
# Solar id (Replace with your id) - integer format
sbu_net_id=123456789
# Solar password (Replace with your password) - string format
sbu_password="YourPassword"
# Join any WhatsApp group and get the link for that group.
# Replace with the whatsApp group ending code for a whatsapp group shared link.
# Eg: if whatsapp gorup shared link is https://chat.whatsapp.com/abcdefxxxxxxxxxxxwxyz
# Then use whatsapp_group_id="abcdefxxxxxxxxxxxwxyz" - string format
whatsapp_group_id="xxxxxxxxxxxxxxxxxxxxx"
- Optional, not required - [Only needed in case of whatsapp web messages are being typed in group chat but not being sent.]
Change X,Y values in pyautogui.click(1475, 645), if the message is automatically typed in whatsaspp group chat, but the text is not getting submitted. (Present in Cell 5 of notebook).
Find the approx coordinates of submit button using mouse coordinate extension - https://chrome.google.com/webstore/detail/mouse-coordinates/mfohnjojhopfcahiddmeljeholnciakl - Close any unnecessary chrome tabs, Now run all the 5 cells and and keep the laptop aside.
The screen should be active all the time and mouse pointer should not be in any notebook cells, click it somewhere else outside the cells and in jupyter notebook.
Python Selenium does the following:
- Logins into solar with your creds.
- Then navigates to enrollment.
- Then navigates to schedule builder.
- Opens schedule builder and saves the authentication cookies to use same cookies until they expire.
- If cookies expire, then load new cookies by repeating again from step 1.
Api does the following:
- Uses the auth cookies from selenium and goes to schedule builder.
- It check for the term, course, course number, open seats, etc.
- If open seats found in your mentioned course list, it send a whatsapp message to your group by opening whatsapp in a new tab.
This is for educational purpoase only, use at your own risk, I am not responsible for any damages or things.
- Use your own credentials for login.
- Dont run for very long time as multiple API calls may make the server slow.
- Dont run the API too frequently by reducing the wait time.
- Contact respective SBU admins if you want to know if this is allowed or not, I am not responsible.
- Can use other data elements like flags, waitlist, etc and many other details... which are retrived from the API, but not used in this project.
- I wrote very basic code, without any validations and not catching any excepting, this can be improved.
https://prod.ps.stonybrook.edu/psp/csprods/?cmd=login
Got inspired from the github repo: https://github.com/cougargrades/collegescheduler by Austin Jackson in which he did similar thing for UT, but I used totally different codes, libraries & concepts for SBU.