Skip to content

Instantly share code, notes, and snippets.

@Poohl
Created May 17, 2023 17:17
Show Gist options
  • Save Poohl/f857240ceb62479f9b4c2750833ff082 to your computer and use it in GitHub Desktop.
Save Poohl/f857240ceb62479f9b4c2750833ff082 to your computer and use it in GitHub Desktop.
Curl magic to check the Rathaus Würzburg page for available appointments and send a Telegram message if so.
real_url=$(curl -Lsw '%{url_effective}' -c cookies -o /dev/null "https://stadt-wuerzburg.saas.smartcjm.com/m/stadt-wuerzburg/extern/calendar/?uid=1dcd9020-d52e-467e-aaec-59d0cfc2e198")
echo "real url ${real_url}"
post_data='action_type=next_step&step_active=3&services=&locations=&locations=30a881af-e2fe-480d-92f1-7e94156cc141&plz=&service_dbdacaa8-5898-474e-b754-1d22685c14b9_amount=0&service_ca418569-6920-4d11-8e4a-261f1d8827c7_amount=0&service_7479a4c0-338d-43f3-9d2f-152ab773e653_amount=0&service_2104c42b-5f35-4e05-a220-66cf31c8f372_amount=0&service_22f12781-6faf-42c0-a990-d4aa07851ac5_amount=0&services=950e6638-ef8e-499b-ab15-e285d6c84c47&service_950e6638-ef8e-499b-ab15-e285d6c84c47_amount=1&service_b7a019dc-1565-4f8f-90fa-172a66abf632_amount=0&service_ae62574c-edbe-467d-9090-ee4f36409091_amount=0&service_46b2990b-c7d2-4f81-89de-2f737c902d9b_amount=0&service_0e07461c-bc18-4e3c-b516-bf96bf14247d_amount=0&service_e4fb304d-82d7-4c47-a245-9f38e059a4c5_amount=0&service_df3872cc-28e0-4862-9c2b-e2c0b47ea56c_amount=0&service_9c935f6a-dc4a-4616-9f1d-da7f4551f33b_amount=0&service_0fc7e79c-045a-4325-88a1-d76927bb1fd5_amount=0&service_ae69d87e-7d56-4909-aac1-5d9a157bfa1f_amount=0&service_6cd97fdc-f6cb-4879-a747-7e993f2f25d5_amount=0&service_77472440-63a4-4852-a734-b3c0fbe9daaa_amount=0&service_e9e944d0-2fdb-41f1-9213-c1bd45606088_amount=0&service_c3a4792f-3400-4302-b45f-b012d9975aed_amount=0&service_c41b1418-5731-4994-9a59-666e3b5b2c56_amount=0&service_cab5d394-bca3-4ed1-84e0-941250f3f74c_amount=0&service_e99ba5d2-cd56-4b5e-b8c5-0c5d2a31ec88_amount=0&service_bfbaad8e-39ff-4a71-a1e1-3f87e2ba72b1_amount=0&service_c2071e4f-d285-468c-8e09-9c85bf97b910_amount=0&service_8784f21d-6aa4-4897-805b-9a08ff00ca3f_amount=0&service_2cab817f-cd98-40f2-a254-cc8913138efa_amount=0&weekdays=&weekdays=1&weekdays=2&weekdays=3&weekdays=4&weekdays=5&time_ranges=&time_ranges=0-720&time_ranges=720-1440&appointments_from=2022-10-11'
available=$(curl --data ${post_data} -s "${real_url}" | grep "var pA" | grep -I "nothing" )
echo "$available"
if [ -n "$available" ]
then
echo "nothing found"
else
curl "https://api.telegram.org/bot<ID>:<token>/sendMessage" -d chat_id=<ich> -d text="Termin Verfügbar!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment