Created
July 14, 2021 10:24
-
-
Save mfalkvidd/a3235092c625b141eafb374158814358 to your computer and use it in GitHub Desktop.
Get all stations form the SATNOGS API
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 | |
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