Skip to content

Instantly share code, notes, and snippets.

@eliask
Last active May 28, 2022 14:10
Show Gist options
  • Save eliask/e6e3973791890ea40bfd605de7cfc335 to your computer and use it in GitHub Desktop.
Save eliask/e6e3973791890ea40bfd605de7cfc335 to your computer and use it in GitHub Desktop.
Fetch data on places which accept Edenred.fi cards/vouchers
#! /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