]>
iEval git - www-search-coveralia.git/blob - WWW/Search/Coveralia.pm
1 package WWW
:: Search
:: Coveralia
;
6 use parent qw
/WWW::Search/ ;
8 our $VERSION = '0.000_001' ;
9 our $MAINTAINER = 'Marius Gavrilescu <marius @ieval .ro>' ;
14 sub _native_setup_search
{
15 my ( $self , $native_query , $options ) = @_ ;
16 $self -> agent_email ( 'marius @ieval .ro' );
18 my $base_url = $options ->{ search_url
} // $self -> DEFAULT_URL ;
19 $self ->{ search_debug
} = $options ->{ search_debug
};
20 $self ->{ _next_url
} = " $base_url ?bus= $native_query " ;
21 $self -> user_agent -> delay ( 10 / 60 ); # Crawl-Delay: 10 in robots.txt
25 my ( $self , $tree ) = @_ ;
28 my $result_table = $tree -> look_down ( class => 'mostrar' );
29 return unless $result_table ;
30 my @results = $result_table -> find ( 'tbody' )-> find ( 'tr' );
32 my $result = $self -> process_result ( $_ );
33 push @
{ $self ->{ cache
}}, $result ;
34 say STDERR
'Title: ' , $result -> title , ' URL: ' , $result -> url if $self ->{ search_debug
};
38 my $url = $tree -> look_down ( rel
=> 'next' );
39 $self ->{ _next_url
} = $self -> absurl ( $self ->{ _prev_url
}, $url -> attr ( 'href' )) if defined $url ;
41 say STDERR
"Found: $found " if $self ->{ search_debug
};
42 say STDERR
'Next URL: ' , $self ->{ _next_url
} if $self ->{ search_debug
} && $self ->{ _next_url
};
51 WWW::Search::Coveralia - search coveralia.com with WWW::Search
56 my $search = WWW::Search->new('Coveralia::Artists'); # or Coveralia::Albums
57 $search->native_query('query');
58 # see WWW::Search documentation for details
62 WWW::Search::Coveralia is a subclass of WWW::Search that searches the L<http://coveralia.com> cover art website.
64 This module is the backend for L<WWW::Search::Coveralia::Artists> and L<WWW::Search::Coveralia::Albums> and should not be used directly. Read the documentation of those two modules for usage information.
68 L<http://coveralia.com>, L<WWW::Search>, L<WWW::Search::Coveralia::Artists>, L<WWW::Search::Coveralia::Albums>
72 Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
74 =head1 COPYRIGHT AND LICENSE
76 Copyright (C) 2014 by Marius Gavrilescu
78 This library is free software; you can redistribute it and/or modify
79 it under the same terms as Perl itself, either Perl version 5.18.2 or,
80 at your option, any later version of Perl 5 you may have available.
This page took 0.05259 seconds and 4 git commands to generate.