Skip to content

Instantly share code, notes, and snippets.

@GeorgeErickson
Created December 19, 2017 19:45
Show Gist options
  • Save GeorgeErickson/4795c49b37a2a94b19db804025848db8 to your computer and use it in GitHub Desktop.
Save GeorgeErickson/4795c49b37a2a94b19db804025848db8 to your computer and use it in GitHub Desktop.
gf wants a sweater that is out of stock
#!/usr/bin/env bash
set -euE -o pipefail -o noclobber
lookup() {
local matches=$(wget -qO- "http://www.patagonia.com/on/demandware.store/Sites-patagonia-us-Site/en_US/Product-Variation?pid=25542&dwvar_25542_color=TUCV&dwvar_25542_size=M" | pup '.availability-msg > p.in-stock-msg' | wc -l)
echo "$matches"
if [ "$matches" -gt 0 ]; then
terminal-notifier -message "in stock"
fi
}
while : ; do
lookup
sleep 300
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment