#!/usr/bin/perl # # This script will download the Earth Science Picture of the Day (http://epod.usra.edu/) # to a specific location you designated in this file. # # requires: # Mac OS X # perl and curl (should be installed (by developerstools?)) # # This script is based the apod script made by Harold Bakker, harold@haroldbakker.com # http://www.haroldbakker.com/personal/apod.php # # This file is provided "as is", and is licensed uder GPL. # NOTE: The images you downloaded with this script may be copyrighted. chdir "/tmp"; my $logfile = "epod.html"; if (!$logfile) { print "Temporary file not specified.\n"; exit(1); } # # get the html file with a link to the new picture of the day # `curl http://epod.usra.edu/index.php3 -o "epod.html"`; # # open the html file and look for the link to the big version # open (LOG, "< $logfile") || die "Can't read $logfile"; @logfile = <LOG>; foreach $line(@logfile) { $_ = "$line"; if (/HREF\=\ "archive\/images\/(.*?)"/) { # download the new picture `curl -O "http://epod.usra.edu/archive/images/$1"`; # get this version $myFile = "/tmp/$1"; } else { # do nothing } } # change the desktop picture `cp "$myFile" /PATH/To/Your/preferred/location`; # clean up close(LOG); `rm $logfile`; `rm $myFile`; __END__