Changeset 627

Show
Ignore:
Timestamp:
04/20/06 15:24:24
Author:
miyagawa
Message:

LivedoorReader?: persistent cookie support

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/Subscription/LivedoorReader.pm

    r625 r627  
    2525sub init_reader { 
    2626    my $self = shift; 
    27     $self->{mech} = WWW::Mechanize->new
     27    $self->{mech} = WWW::Mechanize->new(cookie_jar => $self->cache->cookie_jar)
    2828 
    2929    unless (defined($self->conf->{username}) && defined($self->conf->{password})) { 
     
    115115    $self->{mech}->get("http://reader.livedoor.com/reader/"); 
    116116 
    117     $self->{mech}->submit_form( 
    118         form_name => 'loginForm', 
    119         fields => { 
    120             livedoor_id => $self->conf->{username}, 
    121             password    => $self->conf->{password}, 
    122         }, 
    123     ); 
     117    if ($self->{mech}->content =~ /name="loginForm"/) { 
     118        Plagger->context->log(debug => "Logging in to Livedoor Reader"); 
     119        $self->{mech}->submit_form( 
     120            form_name => 'loginForm', 
     121            fields => { 
     122                livedoor_id => $self->conf->{username}, 
     123                password    => $self->conf->{password}, 
     124            }, 
     125        ); 
    124126 
    125     if ( $self->{mech}->content =~ /class="headcopy"/ ) { 
    126         Plagger->context->error("Failed to login using username & password"); 
     127        if ( $self->{mech}->content =~ /class="headcopy"/ ) { 
     128            Plagger->context->error("Failed to login using username & password"); 
     129        } 
    127130    } 
    128131}