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
# | |
# DSCOVR:EPIC Downloader | |
# | |
# | |
# | |
# This script will scrape the latest image from the DSCOVR satellite, saving it | |
# in My Pictures\DSCOVR\ and then set as the desktop background. | |
# | |
# http://epic.gsfc.nasa.gov/ | |
# |
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
#!/usr/bin/env bash | |
download_directory="$HOME/Desktop/_dl/epic-earth"; | |
apiurl="http://epic.gsfc.nasa.gov/api/images.php"; | |
curl -s "$apiurl" | jshon -a -e image -u | while read image; do | |
destfile="$download_directory/$image.jpg"; | |
mkdir -p "$download_directory"; | |
if [[ -n "$image" && ! -f "$destfile" ]]; then | |
echo "New 🌍 ! $image.jpg"; | |
curl -so "$destfile" "http://epic.gsfc.nasa.gov/epic-archive/jpg/$image.jpg"; | |
ln -sf "$destfile" "$download_directory/latest.jpg"; |