Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 2.14 KB

README.md

File metadata and controls

39 lines (27 loc) · 2.14 KB

WOKO New Room Notifier

Python script sending push notifications whenever a new room is published on the WOKO (student association for housing in Zurich) website.

What this Script Does

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.

Running the Script

Steps for running the script locally are:

  1. Install bs4 and lxml with pip3 install bs4 lxml or pip3 install -r requirements.txt.
  2. Install the push-notification app companion, Ntfy.sh. The Android app is here.
  3. 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).
  4. Run the scraper.py file, with python3 scraper.py.
  5. ???
  6. Enjoy

Running the script on the cloud

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:

  1. Create the VM.
  2. SSH into the VM.
  3. Clone the repository git clone https://github.com/theodormoroianu/WOKO_New_Room_Notification.
  4. Install bs4 and lxml by running pip3 install bs4 lxml.
  5. Open a TMUX shell. This ensures the script keeps running even after closing the terminal: tmux new -s "scraper".
  6. Move into the repository, and run the scraper: python3 scraper.py.
  7. Exit from the tmux shell, by either closing the terminal, or pressing CTRL+B followed by D. DO NOT type CTRL+C, as it will terminate the python app.
  8. For attaching back to the TMUX shell, simply type in the SSH window tmux attach -t "scraper".