Skip to content

Instantly share code, notes, and snippets.

@hamidzr
Created August 14, 2019 22:55
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 hamidzr/ef428dafc254a83447c85399b65a5236 to your computer and use it in GitHub Desktop.
Save hamidzr/ef428dafc254a83447c85399b65a5236 to your computer and use it in GitHub Desktop.
fetch daily signature prices from https://mychefbobby.myshopify.com/ into csv
#!/bin/bash
# fetch daily signature prices from https://mychefbobby.myshopify.com/ into csv
type pup > /dev/null
if [ $? != 0 ]; then
echo "pup" is required for this script to work
exit 1
fi
# clean classics
fetch()
{
local product=$1
curl -s https://mychefbobby.myshopify.com/collections/clean-classics/products/$product \
| pup '#ProductSelect-product-template text{}' | grep -iE '[0-9].*usd' -o \
| sed "s/^/$product \/ /" | sed 's/usd//gi; s/\$//gi; s/ - / \/ /; s/\s\+/ /g;' # s/\s\+\/\s\+/,/g'
# curl -s $url | pup '#ProductSelect-product-template text{}' | grep -i 'usd'
}
# uncomment if you'd like to also get clean meal prices
# fetch clean-beef
# fetch clean-grilled-chicken
# fetch turkey-green-beans
# signature meals
curl -s https://mychefbobby.myshopify.com/collections/signature-meals \
| pup 'a.product-card text{}' | grep -E '\w' | grep -viE '(view|regular)' \
| sed 's/^\s\+//; s/;//g; s/\$ /$/g' \
| tr '\n' ';' | sed 's/;\$/,$/g; s/;/\n/g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment