Created
June 23, 2021 13:22
-
-
Save byrnedo/243ce5d9e04292e05365fab5465523b7 to your computer and use it in GitHub Desktop.
Swedish Vaccination Time Checker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# FIXME | |
WEBHOOK_URL=YOUR_SLACK_WEBHOOK_URL_HERE | |
# A list of the clinics you're interested in polling, you'll find them via the 1177 links | |
for clin in 1546 500 493 2053 2056 521 528 506; do | |
apt=$(curl -s https://booking-api.mittvaccin.se/clinique/$clin/appointmentTypes |jq -r '.[] |select(.name == "1 pers Covid-19 30-64 år (född -57 till -91)")|.id') | |
echo $clin $apt | |
curl https://booking-api.mittvaccin.se/clinique/$clin/appointments/$apt/slots/210601-210731 -s |jq -e '.[].slots |any(.[]; .available == true)'|grep true | |
if [ $? -eq 0 ]; then | |
time=$(date +%s) | |
name=$(curl -s https://booking-api.mittvaccin.se/clinique/$clin |jq -r '.[].name') | |
# slack message | |
curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"$time: Times available $name: https://bokning.mittvaccin.se/klinik/$clin/bokning\"}" "$WEBHOOK_URL" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment