NAME
Google::Ranker - Find the ranking of a site/result against a search
VERSION
Version 0.02
SYNOPSIS
use Google::Ranker;
my $rank = Google::Ranker->rank("search.cpan.org", { q => "perl network", key => ..., referer => ... });
# (Make sure to get a valid key and referer from http://code.google.com/apis/ajaxsearch/signup.html first)
# Or pass in a prepared search:
my $search = Google::Search->Local(...);
my $rank = Google::Ranker->rank("example.com", $search);
# You can also rank against different criteria:
my $search = Google::Search->Video(q => "tay zonday", ...);
my $rank = Google::Ranker->rank(sub { $_[0]->titleNoFormatting =~ m/Chocolate Rain/i }, $search);
DESCRIPTION
Google::Ranker will determine the rank of a result matching some criteria within a search. The search can be done on any of Google's search services, including web, local, news, blogs, images, videos, and books.
This connects to Google's AJAX Search API (http://code.google.com/apis/ajaxsearch/) and is built upon Google::Search
METHODS
Google::Rank->rank( <match>, <search> )
Returns the numeric rank for <match> in <search>
Returns undef if <match> is not found (very possible, since the Google AJAX API only returns a limited number of results at this time)
The first result from Google is ranked at 1
The parameter <match> can either be a string converted into a regular expression, a regular expression to be matched against the uri of each result, or a code reference passed each result (in turn) as the first parameter.
The parameter <search> should be a Google::Search or a hash reference to be passed to Google::Search->new(...)
At minimum you must pass in a key
, a referer
, and a q
(the actual query)
AUTHOR
Robert Krimen, <rkrimen at cpan.org>
SEE ALSO
BUGS
Please report any bugs or feature requests to bug-google-ranker at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Google-Ranker. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Google::Ranker
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
Copyright 2008 Robert Krimen, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.