Simples Web Crawler utilizando o WWW::Mechanize.
O script contem 27 linhas e esta com um filtro que irá pegar apenas URLs que contenham "http" no inicio.
Bons estudos
O script contem 27 linhas e esta com um filtro que irá pegar apenas URLs que contenham "http" no inicio.
Código:
#!/usr/bin/perl #Developed by Marck #Follow-me on twitter: # http://twitter.com/7mm5l use WWW::Mechanize; print "Simple Web Crawler Usage: perl $0 [target] "; if (length($ARGV[0])==0){ exit(); } if($ARGV[0] !~ /^http/){ $ARGV[0]='http://'.$ARGV[0]; } $marck = WWW::Mechanize->new(); $marck->get($ARGV[0]); @links = $marck->links(); print "\nURLs found: \n"; foreach $links(@links){ $link = $links->url; if($link =~ /http/){ print $link."\n"; } }