| 31 | | my $response = $self->{mixi}->login; |
|---|
| 32 | | unless ($response->is_success) { |
|---|
| 33 | | $context->log(error => "Login failed."); |
|---|
| 34 | | return; |
|---|
| | 32 | my $start_url = 'http://mixi.jp/new_friend_diary.pl'; |
|---|
| | 33 | my $response = $self->{mixi}->get($start_url); |
|---|
| | 34 | |
|---|
| | 35 | if ($response->content =~ /action=login\.pl/) { |
|---|
| | 36 | $context->log(debug => "Cookie not foud. Logging in"); |
|---|
| | 37 | $response = $self->{mixi}->post("http://mixi.jp/login.pl", { |
|---|
| | 38 | next_url => "/new_friend_diary.pl", |
|---|
| | 39 | email => $self->conf->{email}, |
|---|
| | 40 | password => $self->conf->{password}, |
|---|
| | 41 | sticky => 'on', |
|---|
| | 42 | }); |
|---|
| | 43 | if (!$response->is_success || $response->content =~ /action=login\.pl/) { |
|---|
| | 44 | $context->log(error => "Login failed."); |
|---|
| | 45 | return; |
|---|
| | 46 | } |
|---|
| | 47 | |
|---|
| | 48 | # meta refresh, ugh! |
|---|
| | 49 | if ($response->content =~ m!"0;url=(.*?)"!) { |
|---|
| | 50 | $response = $self->{mixi}->get($1); |
|---|
| | 51 | } |
|---|