🟒 The price tag

You get: an exit code that knows when to buy. Pairs with: cron, &&, impulse control.

tabstack extract json "$PRODUCT_URL" 
  --schema '{"type":"object","properties":{"price":{"type":"number"}}}' 
  | jq -e '.price < 499' && open "$PRODUCT_URL"

What it does

Extracts the current price from any product page as a number, then uses jq -e to turn the price check into an exit code. If the price is below your threshold, jq -e exits 0 and && triggers the next command. If not, it stops.

jq -e exits non-zero when the condition is false. The whole alerting system is the shell.

Monitor on a schedule

# crontab -e
# Check every hour, open browser when price drops
0 * * * * tabstack extract json "https://shop.example.com/product" 
  --schema '{"type":"object","properties":{"price":{"type":"number"}}}' 
  | jq -e '.price < 499' && open "https://shop.example.com/product"

Alert instead of opening

# Send a notification instead of opening a browser
tabstack extract json "$PRODUCT_URL" 
  --schema '{"type":"object","properties":{"price":{"type":"number"},"name":{"type":"string"}}}' 
  | jq -e 'if .price < 499 then . else error end' 
  | jq -r '"Price drop: (.name) is now $(.price)"' 
  | terminal-notifier -title "Price Alert"

Multi-product watch

urls=(
  "https://shop.example.com/product-a"
  "https://shop.example.com/product-b"
)

for url in "${urls[@]}"; do
  result=$(tabstack extract json "$url" 
    --schema '{"type":"object","properties":{"price":{"type":"number"},"name":{"type":"string"}}}')

  price=$(echo "$result" | jq -r .price)
  name=$(echo "$result" | jq -r .name)

  if (( $(echo "$price < 499" | bc -l) )); then
    echo "ALERT: $name dropped to $$price"
  fi
done

Why a number schema

Without --schema, extract json returns whatever structure the API infers. With --schema '{"type":"object","properties":{"price":{"type":"number"}}}'}, you’re guaranteed a numeric price even when the page displays it as β€œ$499.00” or β€œβ‚¬499,00”. The API handles currency symbol stripping and decimal normalization.