Changeset 807
- Timestamp:
- 05/24/06 18:48:44
- Files:
-
- trunk/plagger/lib/Plagger/Cookies.pm (added)
- trunk/plagger/lib/Plagger/Plugin.pm (modified) (2 diffs)
- trunk/plagger/lib/Plagger/Plugin/CustomFeed/Frepa.pm (modified) (2 diffs)
- trunk/plagger/lib/Plagger/Plugin/CustomFeed/Mixi.pm (modified) (2 diffs)
- trunk/plagger/lib/Plagger/Plugin/CustomFeed/Yahoo360JP.pm (modified) (1 diff)
- trunk/plagger/lib/Plagger/Plugin/Notify/Campfire.pm (modified) (1 diff)
- trunk/plagger/lib/Plagger/Plugin/Subscription/LivedoorReader.pm (modified) (1 diff)
- trunk/plagger/lib/Plagger/UserAgent.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plagger/lib/Plagger/Plugin.pm
r593 r807 5 5 __PACKAGE__->mk_accessors( qw(conf rule rule_hook cache) ); 6 6 7 use Plagger::Cookies; 7 8 use Plagger::Crypt; 8 9 use Plagger::Rule; … … 114 115 } 115 116 117 sub cookie_jar { 118 my $self = shift; 119 120 my $agent_conf = Plagger->context->conf->{user_agent} || {}; 121 if ($agent_conf->{cookies}) { 122 return Plagger::Cookies->create($agent_conf->{cookies}); 123 } 124 125 return $self->cache->cookie_jar; 126 } 127 116 128 1; trunk/plagger/lib/Plagger/Plugin/CustomFeed/Frepa.pm
r650 r807 25 25 my ($self, $context) = @_; 26 26 27 $self->{mech} = WWW::Mechanize->new(cookie_jar => $self->c ache->cookie_jar); # enbug???27 $self->{mech} = WWW::Mechanize->new(cookie_jar => $self->cookie_jar); 28 28 $self->{mech}->agent_alias( "Windows IE 6" ); 29 29 … … 132 132 return 0 unless $self->{mech}->success; 133 133 134 open FOO, ">foo"; 135 print FOO $self->{mech}->content; 136 134 137 if ($self->{mech}->content =~ /loginside/) { 135 138 Plagger->context->log(debug => "cookie not found. logging in"); trunk/plagger/lib/Plagger/Plugin/CustomFeed/Mixi.pm
r677 r807 54 54 sub load { 55 55 my($self, $context) = @_; 56 57 my $cookie_jar = $self->cookie_jar; 58 if (ref($cookie_jar) ne 'HTTP::Cookies') { 59 # using foreign cookies = don't have to set email/password. Fake them 60 $self->conf->{email} ||= 'plagger@localhost'; 61 $self->conf->{password} ||= 'pl4gg5r'; 62 } 63 56 64 $self->{mixi} = WWW::Mixi->new($self->conf->{email}, $self->conf->{password}); 57 $self->{mixi}->cookie_jar($ self->cache->cookie_jar);65 $self->{mixi}->cookie_jar($cookie_jar); 58 66 59 67 my $feed = Plagger::Feed->new; … … 79 87 if ($response->content =~ /action=login\.pl/) { 80 88 $context->log(debug => "Cookie not found. Logging in"); 89 90 if ($self->conf->{email} eq 'plagger@localhost') { 91 $context->log(error => 'email/password should be set to login'); 92 } 93 81 94 $response = $self->{mixi}->post("http://mixi.jp/login.pl", { 82 95 next_url => $next_url, trunk/plagger/lib/Plagger/Plugin/CustomFeed/Yahoo360JP.pm
r533 r807 35 35 my $start = "http://360.yahoo.co.jp/"; 36 36 37 my $mech = WWW::Mechanize->new(cookie_jar => $self->c ache->cookie_jar);37 my $mech = WWW::Mechanize->new(cookie_jar => $self->cookie_jar); 38 38 $mech->agent_alias( 'Windows IE 6' ); 39 39 $mech->get($start); trunk/plagger/lib/Plagger/Plugin/Notify/Campfire.pm
r447 r807 51 51 my $plugin = shift; 52 52 53 my $mech = WWW::Mechanize->new(cookie_jar => $plugin->c ache->cookie_jar);53 my $mech = WWW::Mechanize->new(cookie_jar => $plugin->cookie_jar); 54 54 $mech->agent_alias("Windows IE 6"); 55 55 trunk/plagger/lib/Plagger/Plugin/Subscription/LivedoorReader.pm
r794 r807 25 25 sub init_reader { 26 26 my $self = shift; 27 $self->{mech} = WWW::Mechanize->new(cookie_jar => $self->c ache->cookie_jar);27 $self->{mech} = WWW::Mechanize->new(cookie_jar => $self->cookie_jar); 28 28 29 29 unless (defined($self->conf->{username}) && defined($self->conf->{password})) { trunk/plagger/lib/Plagger/UserAgent.pm
r572 r807 3 3 use base qw( LWP::UserAgent ); 4 4 5 use Plagger::Cookies; 5 6 use URI::Fetch 0.06; 6 7 … … 10 11 $self->agent("Plagger/$Plagger::VERSION (http://plagger.bulknews.net/)"); 11 12 $self->timeout(15); # xxx to be config 13 14 my $conf = Plagger->context->conf->{user_agent}; 15 if ($conf->{cookies}) { 16 $self->cookie_jar( Plagger::Cookies->create($conf->{cookies}) ); 17 } 18 12 19 $self; 13 20 }
