Skip to content

Instantly share code, notes, and snippets.

@stoiandan
Last active June 3, 2023 04:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stoiandan/07d14a9d007c1be408188bdf576e5baf to your computer and use it in GitHub Desktop.
Save stoiandan/07d14a9d007c1be408188bdf576e5baf to your computer and use it in GitHub Desktop.
#!/bin/sh
# Get notified when you favorite cars are avlailbe!
URL="https://www.autovit.ro/autoturisme/de-la-2017\?search%5Bfilter_enum_damaged%5D\=0\&search%5Bfilter_enum_gearbox%5D\=automatic\&search%5Bfilter_enum_keyless_entry%5D\=1\&search%5Bfilter_enum_keyless_go%5D\=1\&search%5Bfilter_enum_no_accident%5D\=1\&search%5Bfilter_enum_original_owner%5D\=1\&search%5Bfilter_enum_pollution_standard%5D\=euro-6\&search%5Bfilter_float_mileage%3Ato%5D\=125000\&search%5Bfilter_float_price%3Ato%5D\=11000\&search%5Badvanced_search_expanded%5D\=true"
RESULT=$(eval curl -s $URL | grep -ic "Nu sunt rezultate")
if [ $RESULT -eq 0 ]; then
# if macOS show a dialog on screen
if [ $OSTYPE[1,6] = 'darwin' ]; then
osascript >/dev/null <<EOT
tell app "System Events" to display dialog "You got cars!"
EOT
fi
echo "There was at least one car at: $(date '+%d-%m-%y %H:%M')" >> ~/car_results.log
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment