Last active
September 29, 2023 10:46
-
-
Save ErwanDavid/0cd241fc81e5b1d51c1ffa86c531887e to your computer and use it in GitHub Desktop.
Get Astronomy Photo of the Day from the NASE (need jq)
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
start='2018-01-01' | |
end='2022-02-01' | |
key='your sevret key' # see https://api.nasa.gov/ | |
start=$(date -d $start +%Y%m%d) | |
end=$(date -d $end +%Y%m%d) | |
while [[ $start -le $end ]] | |
do | |
curDate=$(date -d $start +%Y-%m-%d) | |
echo $curDate | |
curl "https://api.nasa.gov/planetary/apod?api_key=$key&date=$curDate" | |
wget `curl "https://api.nasa.gov/planetary/apod?api_key=$key&date=$curDate" | jq .url | tr -d '"'` | |
start=$(date -d"$start + 1 day" +"%Y%m%d") | |
sleep 5 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The goal is to download automatically all the picture of the APOD https://apod.nasa.gov/apod/
You need to create an API key (free)
You need curl and jq (and a shell ...)