Created
January 9, 2025 21:29
-
-
Save luckylittle/4f8d97b8893ace8e6be065a440388d8e to your computer and use it in GitHub Desktop.
Price checker for PBTech
This file contains 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 | |
CURRENT_PRICE=$(curl -k https://www.pbtech.com/au/product/DVBVER1863710/Verbatim-97284-Blu-Ray-BD-R-DL-50GB-25Pk-Spindle-W | grep '"price":' | sed 's|<script type="application/ld+json">||' | sed 's|</script>||' | jq '.[] | select(.offers) | .offers[].price') | |
LAST_KNOWN_PRICE=$(cat /home/$USER/pbtech.txt) | |
if [ "$CURRENT_PRICE" = "$LAST_KNOWN_PRICE" ]; | |
then | |
: | |
else | |
echo $CURRENT_PRICE > /home/$USER/pbtech.txt | |
curl -s \ | |
--form-string "token=<REDACTED>" \ | |
--form-string "user=<REDACTED>" \ | |
--form-string "message=$(date -u): Price for BluRay 50GB in PBTech is A$ $CURRENT_PRICE" \ | |
https://api.pushover.net/1/messages.json | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment