#!/usr/bin/perl
# Main purpose is to find and parse mp3 links from HTML page.
# Author: Vulcho Nedelchev
# Version: 1.0
# URL: http://www.vulcho.com/perl/mp3linkfinder.pl
# Modules: HTML::LinkExtractor, LWP::Simple

use HTML::LinkExtractor;
use LWP::Simple qw(get);
use strict;

my $base = shift;

my $html = get($base);
my $LX = new HTML::LinkExtractor();

$LX->parse(\$html);
for my $Link ( @{$LX->links} ) 
{
    if( $Link->{href} =~ m/\.mp3$/i ) {
	print $Link->{href} =~ /^http/ ? $Link->{href} : "$base".$Link->{href}, "\n";
    }    
}
    
undef $LX;