LWP::UserAgent and Google

mspam@itsolve.co.uk mspam at itsolve.co.uk
Mon Jan 13 19:58:59 GMT 2014


It's easy enough, here's some code I wrote a few weeks back:

     my $mech = $self->{mech} = WWW::Mechanize->new();
     $mech->cookie_jar(HTTP::Cookies->new());
     $mech->get('https://www.google.com/accounts/ServiceLogin');
     $mech->form_number(1);
     $mech->field(Email => $USER);
     $mech->field(Passwd => $PASS);
     $mech->click();

Afterwards just ->get whatever page you want to go to next...

Mar

On 13/01/14 20:37, Avishalom Shalit wrote:
> here is a non official way to do so without logging in (for a few attempts,
> with- for more)
> http://stackoverflow.com/questions/17080127/api-alternative-to-google-trends/18082512#18082512
>
> it works - i just tested it
> link for the lazy
> http://www.google.com/trends/fetchComponent?q=google,apple&cid=TIMESERIES_GRAPH_0&export=3
>
>
> -- vish
>
>
>
> On 13 January 2014 12:54, Alan Mosca <nitbix at nitbix.com> wrote:
>
>> Hi guys,
>>
>> Has anyone had experience logging into google accounts (possibly using
>> LWP::UserAgent)?
>> I'm trying to extract data from google trends (which doesn't have an API)
>> and found some examples in Python, but they all seem outdated, so whatever
>> mechanism they were using doesn't seem to work anymore.
>>
>> Thanks!
>>
>> --
>>    Alan
>>



More information about the london.pm mailing list