Last active
May 28, 2022 14:10
-
-
Save eliask/e6e3973791890ea40bfd605de7cfc335 to your computer and use it in GitHub Desktop.
Fetch data on places which accept Edenred.fi cards/vouchers
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
#! /usr/bin/env bash | |
set -eu | |
city=helsinki | |
for type in restaurant sport culture; do | |
for page in {0..5000}; do # limit to 5000 queries on failure. | |
url="https://search.edenred.fi/affiliates?page=${page}&count=30&city=${city}&type=${type}" | |
file=edenred_${type}_${city}_page_${page}.json | |
curl -fL "$url" > "$file" | |
[[ $(jq .items < "$file") = '[]' ]] && { rm "$file"; break; } | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment