Last active
March 31, 2020 16:01
-
-
Save shmick/c4d4aa3fe01c15b9206b9f1f070ab2ff to your computer and use it in GitHub Desktop.
This file contains 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 | |
loblaws_10909() { | |
curl -m10 -s https://www.loblaws.ca/api/pickup-locations/1208/time-slots \ | |
-H 'Site-Banner: loblaw' | | |
jq -e -r '.timeSlots[] | select(.available!=false)' | |
} | |
loblaws_high_tech() { | |
curl -m10 -s https://www.loblaws.ca/api/pickup-locations/1028/time-slots \ | |
-H 'Site-Banner: loblaw' | | |
jq -e -r '.timeSlots[] | select(.available!=false)' | |
} | |
rcss() { | |
curl -m10 -s https://www.realcanadiansuperstore.ca/api/pickup-locations/1030/time-slots \ | |
-H 'Site-Banner: superstore' | | |
jq -e -r '.timeSlots[] | select(.available!=false)' | |
} | |
check() { | |
store=$1 | |
result=$($store | grep startTime) | |
if [ "$?" = 0 ]; then | |
numslots=$(wc -l <<<"$result") | |
echo "$numslots slots found at $store" | |
printf "$result \n\n" | |
fi | |
} | |
check loblaws_10909 | |
check loblaws_high_tech | |
check rcss |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment