WWW::Mixi::Scraperのpatch
WWW::Mixi::Scraperのパッチです。
これで1時間ぐらい悩んでしまったorz
--- Mech.pm.orig 2007-07-30 22:26:28.000000000 +0900
+++ Mech.pm 2007-07-30 22:26:49.000000000 +0900
@@ -76,7 +76,7 @@
$self->{mech}->get($uri);
# adapted from Plagger::Plugin::CustomFeed::Mixi
- if ( $self->content =~ /action="login\.pl"/ ) {
+ if ( $self->content =~ /action="\/?login\.pl"/ ) {
# shouldn't be path but path_query, obviously
$self->{login}->{next_url} = $uri->path_query;
$self->login;
拡張しやすいのがいいですねWM::Scraper。charsbarさん++
この変更はこの間、(以下略
■追記
日付の処理がうまくいってないところがあった
--- Utils.pm.orig 2007-07-03 04:41:10.000000000 +0900
+++ Utils.pm 2007-07-31 14:36:45.000000000 +0900
@@ -23,7 +23,16 @@
}
$string =~ s/^\s+//s;
- my ($date, $time, $dummy) = split /\s+/s, $string, 3;
+ my @string = split /\s+/s, $string;
+ my ($date, $time);
+ if ( $string[2] && $string[2] =~ /\d+:\d+/ ) {
+ $date = join "", @string[0,1];
+ $time = $string[2];
+ }
+ else {
+ $date = $string[0];
+ $time = $string[1];
+ }
$date =~ s/\D/\-/g;
$date =~ s/\-+$//;