#!/usr/bin/perl -w
# collects the daily pic from the nasa web site
$baseurl = "http://antwrp.gsfc.nasa.gov/apod/";
$fullurl = "http://antwrp.gsfc.nasa.gov/apod/astropix.html";
$newurl = "";
$status = "";
# get the html source for the page
@source = `lynx -source $fullurl`;
# scan the source and find the url for the picture
foreach (@source)
{
if (m/IMG/i)
{
s/
<\/a>//i; # strip off the back of the tag
s/\"//g; # strip off the double quotes
$newurl = $baseurl.$_;
print "retrieving $newurl";
}
}
$status = system("lynx -source $newurl > wallpaper.jpg");
####
#!/usr/bin/perl
$url = "http://antwrp.gsfc.nasa.gov/apod/image/0102/iss_sts98a.jpg";
print "retrieving $url";
$status = system ("lynx -source $url > wallpaper.jpg");