Lars Hartmann > WWW-Scroogle-0.0135 > WWW::Scroogle



Annotate this POD

View/Report Bugs
Module Version: 0.0135   Source  


WWW::Scroogle - Perl Extension for Scroogle


Please note that using - which this module is using (may) be a violation of Google's "Terms of Service", of which has been reminded. You can find the TOS at does violate the "No Automated Query" section.

The Author has searched for some easy way to get google results, he stumbled across the Google SOAP Api to which turned out to be useless because google will not give away keys to it anymore, later he found out about Googles Ajax api which turns out to be useless as you can only get the first 20results for a searchterm, now there was only one possibility left: parsing the html output of google webquerys; but while thinking about that the author realized, those guys have already done that job and do provide nice, clean html output which is much easier to parse than google.

To come to an end: WWW::Scroogle does one job - it provides you with usable search results.


   use WWW::Scroogle;
   # create a new WWW::Scroogle object
   my $scroogle = WWW::Scroogle->new;
   # set searchstring
   # get search_results
   my $results = $scroogle->get_results;
   # print rank of the first website whose url matches 'wikipedia'
   print $results->position(qr{wikipedia}).'\n';
   # get all results
   my @results = $results->get_results;
   # iterate over all results
   for (@results){
       print $_->url."\n";


WWW::Scroogle uses LWP to fetch the search results from scroogle and parses the returned html output.



Returns a new WWW::Scroogle object.

$searchstring = $scroogle->searchstring

returns the current searchstring


sets $searchstring as the current searchstring

$language = $scroogle->language

returns the current Language - defaults to all


sets $language as the current language

@languages = $scroogle->languages

Returns a list of avaible languages.

$num_results = $scroogle->num_results

Returns the current number of search results - defaults to 100


sets the number of results


performs search and stores result. expects that a searchstring was set.


returns number of results or false if no results are avaible


returns true if there are stored results and false if there are no results avaible


deletes all saved results

@results = $scroogle->get_results(@list_of_positions)

returns list of WWW::Scroogle::Result objects. or a list of all wanted results if list was provided

@results = $scroogle->get_results_matching( qr{} )

returns a list of result-objects whose url is matching the given string or regexp

$result = $scroogle->get_result($position)

returns the requested result

$position = $scroogle->position( qr{} )

returns the position (counting from 1) of the first result whose url matches the given string or regexp

@positions = $scroogle->positions( qr{} )

returns a list of the positions (counting from 1) of all results whose url's are matching the given string or regexp


Tina Müller

Moritz Lenz


Written by Lars Hartmann, <lars (at) chaotika (dot) org>.


Copyright (C) 2008 by Lars Hartmann, All Rights Reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: