This script automates the process of checking for available accommodations on the CROUS website. It uses Selenium to scrape the webpage, regex to detect available listings, and Twilio to send an SMS notification if accommodations are found. Additionally, it plays an alert sound when availability is detected.
- Uses Selenium to scrape accommodation availability.
- Plays an alert sound if a listing is found.
- Sends an SMS notification via Twilio.
- Runs continuously until an accommodation is found.
Make sure you have the following installed before running the script:
- Python > 3.10
- Google Chrome
- Chrome WebDriver
- Required Python libraries:
pip install selenium pygame twilio
-
Clone the Repository
git clone https://github.com/yourusername/crous-notifier.git cd crous-notifier
-
Set Up Twilio
- # on Twilio
- Get your
account_sid
andauth_token
- Replace
'your_sid'
,'your_token'
, and'your_number'
in the script with your actual Twilio credentials and phone number.
-
Set the Target URL
- Replace
'City_Selected_URL'
with the actual CROUS accommodation URL you want to monitor.
- Replace
-
Run the Script
python script.py
- The script loads the given URL and checks if there are accommodations available using regex.
- If found, it:
- Plays an alarm using
pygame
. - Sends an SMS notification via Twilio.
- Keeps the script running to ensure continued alerts.
- Plays an alarm using
- If no accommodations are found, it waits for a few seconds and retries.
- Ensure that
alert_sound.mp3
is available in the script directory. - Modify the sleep intervals as needed to avoid excessive requests.
- Running Selenium may require adjusting Chrome WebDriver compatibility with your Chrome version.
This script is for personal use only. Be mindful of web scraping policies on the CROUS website.
MIT License
Authors: Youxise, LyesYe