Perl : PDF album Downloader [ SS : GUI ]

SS : เป็นแบบ GUI นะครับ แต่โค้ดด้านล่างเป็นแบบธรรมดา ^^”


#!/usr/bin/perl
#########################################################################
# ░░░░░░░░░░░░▄▄░░░░░░░░░░░░░░ Copyright (c) 2012 by sornram9254.com
# ░░░░░░░░░░░█░░█░░░░░░░░░░░░░
# ░░░░░░░░░░░█░░█░░░░░░░░░░░░░ This software is open source,
# ░░░░░░░░░░█░░░█░░░░░░░░░░░░░ licensed under the GNU/GPL,v3.0
# ░░░░░░░░░█░░░░█░░░░░░░░░░░░░
# ██████▄▄█░░░░░██████▄░░░░░░░ Basically,
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ this means that you're allowed to modify and
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ distribute this software.
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ However, if you distribute modified versions,
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ you MUST also distribute the source code.
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░
# ▓▓▓▓▓▓█████░░░░░░░░░██░░░░░░ See http://www.gnu.org/licenses/gpl.html
# █████▀░░░░▀▀████████░░░░░░░░ for the full license.
#########################################################################
use LWP::Simple;
print "Create new Album...\nName : ";
$album = ;
mkdir($album);
my $ua = LWP::UserAgent->new();
my $content = $ua->get('http://www.eduunix.ccut.edu.cn/index/pdf/')->content;
print "=============================================\n";
print "Please wait to Download...\n";
print "=============================================\n";
while($content =~ m/<\/td>/g){
$file = $1;
$url = "http://www.eduunix.ccut.edu.cn/index/pdf/".$file;
print "Getting ==> $file ..\n";
my $data = LWP::Simple::get $url;
my $filename = $file;
open (FH, "> /home/sornram9254/$album/$filename");
binmode (FH);
print FH $data;
close (FH);
print "\tDone ..\n";
sleep(1);
}

 

 

อยากได้ลูกเล่นอะไรเพิ่มเติมก็ลองไปโมฯกันเองนะครับ ^_^

Published by

sornram9254

Ayutthaya Technical College/Voc.Cert.🛠️ | KMUTNB/B.S.Tech.Ed.⚙️ | Information Security Engineer 👨🏻‍💻| Penetration Tester👨🏻‍💻 | COYG🔴 Milan🔴⚫️ | Taylor Swift👩‍🎤 | ติ่งซีรีส์ญี่ปุ่น 🇯🇵

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.