Python script sending push notifications whenever a new room is published on the WOKO (student association for housing in Zurich) website.
This script continuously fetches the WOKO website for rooms available in Zurich. Whenever a new room is available, the script sends a push notification to phones properly set-up (in a subscriber / publisher fashion).
Assuming you already have an available VM on the cloud (if you don't, get one ASAP), deploying this script requires ~5 mins.
Steps for running the script locally are:
- Install
bs4
andlxml
withpip3 install bs4 lxml
orpip3 install -r requirements.txt
. - Install the push-notification app companion, Ntfy.sh. The Android app is here.
- Open the Ntfy.sh app, and add subscribe to the topic "cazare_woko" (or whatever string you replaced it with at the top of scraper.py).
- Run the
scraper.py
file, withpython3 scraper.py
. - ???
- Enjoy
I highly recommend running the script on a cloud VM. This ensures the script runs 100% of the time.
As it's really tiny, any VM will work, including the free ones given by AWS or Oracle Cloud (I ran this script on an Oracle Cloud instance with one CPU and 1GB of RAM). The steps to do so are:
- Create the VM.
- SSH into the VM.
- Clone the repository
git clone https://github.com/theodormoroianu/WOKO_New_Room_Notification
. - Install
bs4
andlxml
by runningpip3 install bs4 lxml
. - Open a
TMUX
shell. This ensures the script keeps running even after closing the terminal:tmux new -s "scraper"
. - Move into the repository, and run the scraper:
python3 scraper.py
. - Exit from the tmux shell, by either closing the terminal, or pressing
CTRL+B
followed byD
. DO NOT typeCTRL+C
, as it will terminate the python app. - For attaching back to the TMUX shell, simply type in the SSH window
tmux attach -t "scraper"
.