Skip to content

lokku/WWW-Google-WebmasterTools-Download

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NAME

WWW::Google::WebmasterTools::Download - Extract data from Google Webmaster Tools

DESCRIPTION

This distribution is a rip-off of Stephan Schmitz's php-webmaster-tools-downloads library which can be found on Github at https://github.com/eyecatchup/php-webmaster-tools-downloads.

This project provides an easy way to automate downloading of data tables from Google Webmaster Tools and storing the results in CSV files.

It performs these actions essentially by scraping Google Webmaster Tools, because the GWT API does not provide full access to all the data desired.

It is necessary because GWT only shows you data for the last three months, so if you want to track your website for longer than that you have to store the data separately yourself.

SYNOPSIS

use WWW::Google::WebmasterTools::Download;

my $gdata = WWW::Google::WebmasterTools::Download->new(
    email    => 'example@gmail.com',
    password => 'correct horse battery staple',
);

my @data = $gdata->get_content_keywords_data(
    website    => 'http://www.example.org',
);

$gdata->save_top_queries_as_csv(
    website    => 'http://www.example.org',
    filename   => 'content_keywords_data.csv'
);

CONSTRUCTOR

new

Takes an email and password and returns an object with methods to access data from Google Webmaster Tools.

my $gdata = WWW::Google::WebmasterTools::Download->new(
    email    => 'example@gmail.com',
    password => 'correct horse battery staple',
);

Immediately logs in and pre-caches all your site URLs which can be slow if you have a large number of them or a slow internet connection.

Optionally takes a regular expression for filtering on which sites you are interested in; a language (ISO 639-1 2-letter language code); and a user agent.

my $gdata = WWW::Google::WebmasterTools::Download->new(
    email       => 'example@gmail.com',
    password    => 'correct horse battery staple',

    sites_regex => qr/example/,
    language    => 'de',
    ua          => LWP::UserAgent->new(agent => "My Agent Name"),
);

The default sites regex matches all sites, the default language is 'en', and the default user agent has the UserAgent string WWW::Google::WebmasterTools::Download.

SITE METHODS

get_sites

Returns a list of sites available for the user. Obeys the sites_regex parameter passed to new().

my @sites = $gdata->get_sites;

DATA METHODS

Each of these takes a website and returns an array of arrayrefs representing a table of data.

my @data = $gdata->get_top_pages_data(
    website => 'http://www.example.org'
);

get_top_pages_data

get_top_queries_data

get_crawl_errors_data

get_content_errors_data

get_content_keywords_data

get_social_activity_data

CSV METHODS

Each of these takes a website and a filename and writes a CSV file with the data for that website.

$gdata->save_top_queries_as_csv(
    website  => 'http://www.example.org',
    filename => 'example_org_top_queries.csv',
);

save_top_pages_as_csv

save_top_queries_as_csv

save_crawl_errors_as_csv

save_content_errors_as_csv

save_content_keywords_as_csv

save_social_activity_as_csv

About

Perl 5 Library to extract data from Google Webmaster Tools

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages