Skip to content

Instantly share code, notes, and snippets.

@mfalkvidd
Created July 14, 2021 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfalkvidd/a3235092c625b141eafb374158814358 to your computer and use it in GitHub Desktop.
Save mfalkvidd/a3235092c625b141eafb374158814358 to your computer and use it in GitHub Desktop.
Get all stations form the SATNOGS API
#!/bin/bash
PAGE=1
OUTPUT=""
JSONFILE="stations.json"
echo "[" > "$JSONFILE"
while true
do
OUTPUT=$(curl "https://network.satnogs.org/api/stations/?page=$PAGE")
if echo "$OUTPUT" | grep -q 'Invalid page'; then
break;
fi
if [[ $PAGE -gt 1 ]]; then
echo "," >> "$JSONFILE"
fi
echo "$OUTPUT" >> "$JSONFILE"
PAGE=$((PAGE+1))
done
echo "]" >> "$JSONFILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment