#!/bin/bash cd "$(dirname "$0")" # set -eux -o pipefail # make defensive on purpose (really we only wanna crash when extract.py crashes?) # set -ux while true; do date res=$(curl 'https://ch.tlscontact.com/gb/LON/schedule.php?fg_id=848509' -X POST -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:107.0) Gecko/20100101 Firefox/107.0' -H 'Accept: text/javascript, text/html, application/xml, text/xml, */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br' -H 'X-Requested-With: XMLHttpRequest' -H 'X-Prototype-Version: 1.7.3' -H 'Content-type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Content-Length: 0' -H 'Origin: https://ch.tlscontact.com' -H 'Connection: keep-alive' -H 'Referer: https://ch.tlscontact.com/gb/LON/myapp.php?fg_id=848509' -H 'Cookie: current_locale=en; TLScontact=xMKxTayxZ6BxlbSB9hHM5yX5e6bVjHtnGXRXmZKq; uid=CltkGWOP2u3AuwnmBDe2Ag==' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: same-origin' -H 'DNT: 1' -H 'Sec-GPC: 1' | zcat | ./extract.py) if [[ $? == 1 ]]; then notify-send "SOME APPOINTMENTS!!!" ntfy -b telegram send "NEW APPOINTMENTS! \n $res" fi sleep 300 done