Category: | Web stuff |
Author/Contact Info | Scott Peterson peterson146@gmail.com |
Description: | This code gets a web page that you specify at the command line and extracts all links from that page to a list in ASCII text file format. Comments and suggestions for improvement welcome! Updated per suggestions by ikegami and merlyn. |
use strict; use WWW::Mechanize; #usage perl linkextractor.pl http://www.example.com/ > output.txt my $url = shift; my $mech = WWW::Mechanize->new(); $mech->get($url); my $status=$mech->status(); print $status." OK-URL request succeeded."."\n"; my @links = $mech->links; print STDOUT ($_->url, $/) foreach $mech->links; |
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Simple link extraction tool
by ikegami (Patriarch) on Jan 02, 2007 at 21:43 UTC | |
by Scott7477 (Chaplain) on Jan 02, 2007 at 23:38 UTC | |
by jdporter (Paladin) on Jan 03, 2007 at 05:13 UTC | |
Re: Simple link extraction tool
by merlyn (Sage) on Jan 02, 2007 at 21:53 UTC | |
Re: Simple link extraction tool
by arkturuz (Curate) on Jan 03, 2007 at 12:47 UTC | |
Re: Simple link extraction tool
by Scott7477 (Chaplain) on Jan 03, 2007 at 22:09 UTC | |
Re: Simple link extraction tool
by davidrw (Prior) on Jan 03, 2007 at 18:00 UTC | |
Simple link extraction tool-another way
by Scott7477 (Chaplain) on Jan 04, 2007 at 00:27 UTC |
Back to
Code Catacombs