Skip to content

Instantly share code, notes, and snippets.

@luckylittle
Created January 9, 2025 21:29
Show Gist options
  • Save luckylittle/4f8d97b8893ace8e6be065a440388d8e to your computer and use it in GitHub Desktop.
Save luckylittle/4f8d97b8893ace8e6be065a440388d8e to your computer and use it in GitHub Desktop.
Price checker for PBTech
#!/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