#!/usr/bin/perl use LWP::UserAgent; use HTML::LinkExtor; use URI::URL; use CGI::Carp qw(fatalsToBrowser); use CGI qw(param); $url=param('url'); $type=param('type'); print "Content-Type: text/html\n\n"; if($type eq 'txt') { &show_txt; exit; } $ua = new LWP::UserAgent; # Set up a callback that collect image links my @imgs = (); sub callback { my($tag, %attr) = @_; return if $tag=~/[^\"$type\"]/i; # we only look closer at # push(@imgs, values %attr); } # Make the parser. Unfortunately, we don't know the # base yet # (it might be diffent from $url) $p = HTML::LinkExtor->new(\&callback); # Request document and parse it as it arrives $res = $ua->request(HTTP::Request->new(GET => $url), sub {$p->parse($_[0])}); # Expand all image URLs to absolute ones my $base = $res->base; @imgs = map { $_ = url($_, $base)->abs; } @imgs; # Print them out print qq! EXTRACTOR

LINKS FOR

$url

If you wish to transload any of these images to your site click onto the box next to the URL, fill in your FTP information, then click onto Upload Files.....


!; $content = join("\n", @imgs), "\n"; print "
"; print ""; foreach $links(@imgs) { print qq! !; } print qq!
$links


Transload these images to your site....

Username
TargetFTP
Password
Directory

!; close DATA; sub show_txt { use LWP::Simple; $content=get($url); ($content=~s//>/ig); ($content=~s/\n/
/ig); print qq!
TXT SRC FOR

$url


!; print "$content";«\ print ""; } print "";«\