หน้าเว็บ

วันพุธที่ 15 มกราคม พ.ศ. 2557

Save all slide in slideshare.net to image. [ Perl ]

use LWP::UserAgent; 
 
if(@ARGV < 2){
 print "Usage : filename.pl <slideshare_url> <folder_name>";
 exit;
}
$url = $ARGV[0];
$folder = $ARGV[1];
$browser = LWP::UserAgent->new() or die;
$content = $browser->get($url)->content;
$i = 1;
while($content =~ m/data-normal=\"(.*?)\"/g){
        $pic = $1;
        $img = $browser->get($pic)->content;
        open OUTFILE, ">> ".$folder.'/'.$i.'.jpg';
        binmode OUTFILE;
        print OUTFILE $img;
        close OUTFILE;
        print $pic." => Saved \n";
 $i++;
}

Source : https://gist.github.com/icheerno0m/8415974