Last active
May 20, 2019 07:34
-
-
Save JamieMagee/02b64cc95011cf21d9274e357398f550 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 | |
# 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