Created
August 14, 2019 22:55
-
-
Save hamidzr/ef428dafc254a83447c85399b65a5236 to your computer and use it in GitHub Desktop.
fetch daily signature prices from https://mychefbobby.myshopify.com/ into csv
This file contains hidden or 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 | |
# 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