An open API service indexing awesome lists of open source software.

https://github.com/mudler/www--google--autosuggest

WWW::Google::AutoSuggest is a perl module that allows you to use Google Suggest in a quick and easy way and returning it as JSON for further inspection
https://github.com/mudler/www--google--autosuggest

Last synced: over 1 year ago
JSON representation

WWW::Google::AutoSuggest is a perl module that allows you to use Google Suggest in a quick and easy way and returning it as JSON for further inspection

Awesome Lists containing this project

README

          

# NAME

WWW::Google::AutoSuggest - Query the Google services to retrieve the query suggestions

# SYNOPSIS

use WWW::Google::AutoSuggest;
my $AutoSuggest=WWW::Google::AutoSuggest->new();
my @Suggestions = $AutoSuggest->search("perl");
###### or
use WWW::Google::AutoSuggest;
my $AutoSuggest=WWW::Google::AutoSuggest->new(domain=> "it" ,json=>1); #uses www.google.it instead of .com
my $result = $AutoSuggest->search("perl");
# $result now is a decoded JSON arrayref
###### or with the html tags
use WWW::Google::AutoSuggest;
my $AutoSuggest=WWW::Google::AutoSuggest->new(strip_html=>0);
my @Suggestions = $AutoSuggest->search("perl");

# DESCRIPTION

WWW::Google::AutoSuggest allows you to use Google Suggest in a quick and easy way and returning it as decoded JSON for further inspection

# ARGUMENTS

- json

my $AutoSuggest=WWW::Google::AutoSuggest->new(json=>1);

or

$AutoSuggest->json(1);

Explicitally enable the return of the decoded [JSON](https://metacpan.org/pod/JSON) object when calling `search("term")`

- strip\_html

my $AutoSuggest=WWW::Google::AutoSuggest->new(strip_html=>0);

or

$AutoSuggest->strip_html(0);

Explicitally disable the stripping of the HTML contained in the google responses

- raw

my $AutoSuggest=WWW::Google::AutoSuggest->new(raw=>1);

or

$AutoSuggest->raw(1);

Explicitally enable the return of the response content when calling `search("term")`

- domain

my $AutoSuggest=WWW::Google::AutoSuggest->new(domain=>"it");

or

$AutoSuggest->domain("it");

Explicitally use the Google domain name in the request

# METHODS

- new

my $AutoSuggest=WWW::Google::AutoSuggest->new();

Creates a new WWW::Google::AutoSuggest object

- search

my @Suggestions = $AutoSuggest->search($query);

Sends your `$query` to Google web server and fetches and parse suggestions for the given query.
Default returns an array of that form

@Suggestions = ( 'foo bar' , 'baar foo',..);

Setting
$AutoSuggest->json(1);

will return the [JSON](https://metacpan.org/pod/JSON) object

# AUTHOR

mudler

# COPYRIGHT

Copyright 2014 mudler

# LICENSE

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

# SEE ALSO

[https://metacpan.org/pod/WebService::Google::Suggest](https://metacpan.org/pod/WebService::Google::Suggest)