Skip to content

Instantly share code, notes, and snippets.

@shmick
Last active March 31, 2020 16:01
Show Gist options
  • Save shmick/c4d4aa3fe01c15b9206b9f1f070ab2ff to your computer and use it in GitHub Desktop.
Save shmick/c4d4aa3fe01c15b9206b9f1f070ab2ff to your computer and use it in GitHub Desktop.
#!/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