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

Download:
WWW-Scroogle-0.0135.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.0135   Source  

NAME ^

WWW::Scroogle - Perl Extension for Scroogle

CAVEAT ^

Please note that using Scroogle.org - which this module is using (may) be a violation of Google's "Terms of Service", of which scroogle.org has been reminded. You can find the TOS at http://www.google.com/terms_of_service.html

Scroogle.org 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 scroogle.org, 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 scroogle.org search results.

SYNOPSIS ^

   use WWW::Scroogle;
   
   # create a new WWW::Scroogle object
   my $scroogle = WWW::Scroogle->new;
   
   # set searchstring
   $scroogle->searchstring('foobar');
   
   # 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";
   }

DESCRIPTION ^

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

METHODS ^

WWW::Scroogle->new

Returns a new WWW::Scroogle object.

$searchstring = $scroogle->searchstring

returns the current searchstring

$scroogle->set_searchstring($searchstring)

sets $searchstring as the current searchstring

$language = $scroogle->language

returns the current Language - defaults to all

$scroogle->set_language($language)

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

$scroogle->set_num_results

sets the number of results

$scroogle->perform_search

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

$scroogle->nresults

returns number of results or false if no results are avaible

$scroogle->has_results

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

$scroogle->delete_results

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{example.com} )

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{example.com} )

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

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

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

CREDITS ^

Tina Müller

Moritz Lenz

AUTHOR ^

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

COPYRIGHT AND LICENSE ^

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: