#!/usr/bin/perl
# author:
# Seraphxby
# Purpose:
# 查看国家地理每日图片的Perl脚本
# history:
# v0.1 first draft
#
use warnings;
use strict;
use LWP::Simple;
my
$url=‘http://photography.nationalgeographic.com/photography/photo-of-the-day';
my $content = get( “$url” ) || die “get the page failed!\n”;
my $img;
if ($content=~m/(<div class=“image-viewer
clearfix”>.*?<\/a>)/s) {
$content=$1;
if($content=~m/<img.*?src="([^\t]*?)"/){
$img=‘http://photography.nationalgeographic.com’.$1;
if($img=~m/^(.*?)([^\/]+$)/){
$url=$1;
$img=$2;
$img=~s/-ga/-sw/;
getstore($url.$img,$img) || die “get img failed!\n”;
}
}
}