Skip to content

Instantly share code, notes, and snippets.

@JamieMagee
Last active May 20, 2019 07:34
Show Gist options
  • Save JamieMagee/02b64cc95011cf21d9274e357398f550 to your computer and use it in GitHub Desktop.
Save JamieMagee/02b64cc95011cf21d9274e357398f550 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Event Ids
# 3898 - Copenhagen Half Marathon 2018
# 3896 - Royal Run 2018
# 4217 - Copenhagen Marathon 2019
if [ "$#" -ne 2 ]; then
echo "Event ID and runner number required"
exit 1
fi
mkdir -p "$2"
curl -s "https://resultater.cphhalf.dk/api/runners?eventid=$1&entries=$2" | jq -r '.[].images[] | "\(.PictureURL)"' | while read -r PICTURE_URL; do
FILENAME=$(echo "$PICTURE_URL" | awk -F'[=&]' '{print $6}')
curl -s -o "$2/$FILENAME" "$PICTURE_URL"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment