Skip to content

Instantly share code, notes, and snippets.

@filipemp
Created July 8, 2020 09:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save filipemp/ae0a5acea2cd5930900d8c0da8f2688c to your computer and use it in GitHub Desktop.
Save filipemp/ae0a5acea2cd5930900d8c0da8f2688c to your computer and use it in GitHub Desktop.
#!/bin/bash
ROOT_URL="https://service.berlin.de/terminvereinbarung/termin"
FULL_URL="${ROOT_URL}/tag.php?termin=1&anliegen[]=120686&dienstleisterlist=122210,122217,122219,122227,122231,122243,122252,122260,122262,122254,122271,122273,122277,122291,122285,122286,122296,150230,122301,122297,122294,122312,122314,122304,122311,122309,122281,122279,122276,122274,122267,122246,122251,122257,122208,122226&herkunft=http%3A%2F%2Fservice.berlin.de%2Fdienstleistung%2F120686%2F"
DELAY_SEC=600
PATTERN="\"buchbar\""
function show_notification {
osascript -e 'display notification "Termin available for Anmeldung!"'
}
counter=1
while true
do
echo "Run number: $counter"
slot_exists=`wget ${FULL_URL} -qO- | grep -c "${PATTERN}"`
[[ $slot_exists -gt 0 ]] && show_notification && echo "$(date): $slot_exists slots available now!"
((counter++))
sleep ${DELAY_SEC}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment