Skip to content

manwar/WWW-Google-Login

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Travis Build Status AppVeyor Build Status

CONTRIBUTING

NAME

WWW::Google::Login - log a mechanize object into Google

SYNOPSIS

my $mech = WWW::Mechanize::Chrome->new(
    headless => 1,
    data_directory => tempdir(CLEANUP => 1),
    user_agent => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.39 Safari/537.36+',
);
$mech->viewport_size({ width => 480, height => 640 });

$mech->get('https://keep.google.com');

my $login = WWW::Google::Login->new(
    mech => $mech,
);

if( $login->is_login_page()) {
    my $res = $login->login(
        user => 'a.u.thor@gmail.com',
        password => 'my-secret-password',
        headless => 1
    );

    if( $res->wrong_password ) {
        # ?
    } elsif( $res->logged_in ) {
        # yay
    } else {
        # some other error
    }
};

DESCRIPTION

This module automates logging in a (Javascript capable) WWW::Mechanize object into Google. This is useful for scraping information from Google applications.

Currently, this module only works in conjunction with WWW::Mechanize::Chrome, but ideally it will evolve to not requiring Javascript or Chrome at all.

->is_password_page

if( $login->is_password_page ) {
    $login->login( user => $user, password => $password );
};

->is_login_page

if( $login->is_login_page ) {
    $login->login( user => $user, password => $password );
};

->is_login_page_headless

->is_login_page_headfull

->login

my $res = $login->login(
    user => 'example@gmail.com',
    password => 'supersecret',
);
if( $res->logged_in ) {
    # yay
}

About

Log a mechanize object into Google

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Perl 100.0%