Download Specific Images

Posted by thebourneid on Stack Overflow See other posts from Stack Overflow or by thebourneid
Published on 2010-05-31T02:59:45Z Indexed on 2010/05/31 3:02 UTC
Read the original article Hit count: 199

Filed under:

I'm trying to search and download specific images /front and back cover / of a website if found but whatever I do I always download only one of them. What should I change in my code to download both of them if found?

while ($title_found =~ /'(http:\/\/images.blu-ray.com\/movies\/covers\/\d+_.*?)'/gis) {        
    $url = getSite($1);
    if ($title_found =~ /front/) {
             $filename = 'front.jpg';       
        }
        elsif ($title_found =~ /back/) {
     $filename = 'back.jpg';
    }
   }
   my $dir = 'somepath'.$filename;     
   open F, ">", $dir;          
        binmode F;
        print F $url;
   close F; 
   return 0;      

© Stack Overflow or respective owner

Related posts about perl