305 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_till = qq(\Q\E);
 
306 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] new album part is missing.\n") unless ($content =~ /$content_from(.*?)$content_till/s);
  
 
307 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
308 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse new album part
  
 
309 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	while ($content =~ s/(.*?)<\/a>.*?\((.+?)\)  
 
310 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my ($date, $link, $subj, $name) = ((sprintf('%02d/%02d', $1, $2)), $3, $4, $5);
  
 
311 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$subj = $self->rewrite($subj);
  
 
312 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$name = $self->rewrite($name);
  
 
313 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$link = $self->absolute_url($link, $base);
  
 
314 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		push(@items, {'time' => $date, 'link' => $link, 'subject' => $subj, 'name' => $name});
  
 
315 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
316 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
317 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
318 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
319 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_home_new_bbs {
  
 
320 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self     = shift;
  
 
321 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res      = (@_) ? shift : $self->response();
  
 
322 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
323 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base     = $res->base->as_string;
  
 
324 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content  = $res->content;
  
 
325 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items    = ();
  
 
326 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get new bbs part
  
 
327 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_from = qq(\Qコミュニティ最新書き込み\E);
  
 
328 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_till = qq(\Q\E);
 
329 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] new bbs part is missing.\n") unless ($content =~ /$content_from(.*?)$content_till/s);
  
 
330 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
331 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse new bbs part
  
 
332 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	while ($content =~ s/(.*?)<\/a>.*?\((.+?)\)  
 
333 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my ($date, $link, $subj, $name) = ((sprintf('%02d/%02d', $1, $2)), $3, $4, $5);
  
 
334 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$subj = $self->rewrite($subj);
  
 
335 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$name = $self->rewrite($name);
  
 
336 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$link = $self->absolute_url($link, $base);
  
 
337 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		push(@items, {'time' => $date, 'link' => $link, 'subject' => $subj, 'name' => $name});
  
 
338 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
339 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
340 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
341 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
342 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_home_new_comment {
  
 
343 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self     = shift;
  
 
344 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res      = (@_) ? shift : $self->response();
  
 
345 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
346 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base     = $res->base->as_string;
  
 
347 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content  = $res->content;
  
 
348 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items    = ();
  
 
349 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get new comment part
  
 
350 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_from = qq(\Q日記コメント記入履歴\E);
  
 
351 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_till = qq(\Q\E);
 
352 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] new comment part is missing.\n") unless ($content =~ /$content_from(.*?)$content_till/s);
  
 
353 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
354 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse new comment part
  
 
355 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	while ($content =~ s/(.*?)<\/a>.*?\((.+?)\)  
 
356 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my ($date, $link, $subj, $name) = ((sprintf('%02d/%02d', $1, $2)), $3, $4, $5);
  
 
357 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$subj = $self->rewrite($subj);
  
 
358 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$name = $self->rewrite($name);
  
 
359 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$link = $self->absolute_url($link, $base);
  
 
360 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		push(@items, {'time' => $date, 'link' => $link, 'subject' => $subj, 'name' => $name});
  
 
361 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
362 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
363 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
364 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
365 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_home_new_friend_diary {
  
 
366 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self     = shift;
  
 
367 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res      = (@_) ? shift : $self->response();
  
 
368 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
369 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base     = $res->base->as_string;
  
 
370 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content  = $res->content;
  
 
371 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items    = ();
  
 
372 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get new friend diary part
  
 
373 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_from = qq(\Qマイミクシィ最新日記\E.*?\Q \E);
 
 
374 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_till = qq(\Q\E);
 
375 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] new friend diary part is missing.\n") unless ($content =~ /$content_from(.*?)$content_till/s);
  
 
376 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
377 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse new friend diary part
  
 
378 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	while ($content =~ s/(.*?)<\/a>.*?\((.+?)\)  
 
379 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my ($date, $link, $subj, $name) = ((sprintf('%02d/%02d', $1, $2)), $3, $4, $5);
  
 
380 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$subj = $self->rewrite($subj);
  
 
381 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$name = $self->rewrite($name);
  
 
382 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$link = $self->absolute_url($link, $base);
  
 
383 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		push(@items, {'time' => $date, 'link' => $link, 'subject' => $subj, 'name' => $name});
  
 
384 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
385 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
386 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
387 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
388 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_home_new_review {
  
 
389 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self     = shift;
  
 
390 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res      = (@_) ? shift : $self->response();
  
 
391 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
392 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base     = $res->base->as_string;
  
 
393 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content  = $res->content;
  
 
394 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items    = ();
  
 
395 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get new friend diary part
  
 
396 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_from = qq(\Qマイミクシィ最新レビュー\E);
  
 
397 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_till = qq(\Q\E);
 
398 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] new review part is missing.\n") unless ($content =~ /$content_from(.*?)$content_till/s);
  
 
399 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
400 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse new friend diary part
  
 
401 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	while ($content =~ s/(.*?)<\/a>.*?\((.+?)\)  
 
402 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my ($date, $link, $subj, $name) = ((sprintf('%02d/%02d', $1, $2)), $3, $4, $5);
  
 
403 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$subj = $self->rewrite($subj);
  
 
404 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$name = $self->rewrite($name);
  
 
405 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$link = $self->absolute_url($link, $base);
  
 
406 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		push(@items, {'time' => $date, 'link' => $link, 'subject' => $subj, 'name' => $name});
  
 
407 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
408 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
409 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
410 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
411 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_ajax_new_diary {
  
 
412 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
413 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
414 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
415 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
416 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
417 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
418 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_date = q{(\d{1,2})月(\d{1,2})日};
  
 
419 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_link = q{(]+)*>)(.*?)<\/a>};
   
 
420 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_name = q{\((.*?)\)};
  
 
421 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @today = reverse((localtime)[3..5]);
  
 
422 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$today[0] += 1900;
  
 
423 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$today[1] += 1;
  
 
424 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $row ($content =~ /(.*?)<\/div>/isg) {
 
 
 
425 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		next unless ($row =~ /$re_date … $re_link/);
  
 
426 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $item           = {};
  
 
427 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @date           = (undef, $1, $2);
  
 
428 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$item->{'link'}    = $self->absolute_url($self->parse_standard_anchor($3), $base);
  
 
429 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 		$item->{'subject'} = (defined($4) and length($4)) ? $self->rewrite($4) : '(削除)';
  
 
430 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$date[0]           = ($date[1] > $today[1]) ? $today[0] - 1 : $today[0] if (not defined($date[0]));
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
431 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$item->{'time'}    = sprintf('%04d/%02d/%02d', @date);
  
 
432 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		map { $item->{$_} =~ s/^\s+|\s+$//gs } (keys(%{$item}));
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
433 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		push(@items, $item);
  
 
434 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
435 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
436 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
437 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
438 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_community_id {
  
 
439 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
440 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
441 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
442 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
443 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
444 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $item;
  
 
445 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($content =~ /view_community.pl\?id=(\d+)/) {
  
 
446 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$item = $1;
  
 
447 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
448 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $item;
  
 
449 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
450 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
451 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_edit_member {
  
 
452 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
453 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
454 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
455 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
456 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
457 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
458 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get member list part
  
 
459 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_from = qq(\Q\E);
 
460 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_till = qq(\Q  
\E);
  
 
461 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] member list part is missing.\n") unless ($content =~ /$content_from(.*?)$content_till/s);
  
 
462 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
463 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get member list
  
 
464 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content =~ s/[\t\r\n]//g;
  
 
465 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @rows = ($content =~ /  (.*?)<\/tr>/ig);
 
 
466 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] member list has no rows.\n") unless (@rows);
  
 
467 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse rows
  
 
468 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $row (@rows) {
  
 
469 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @cols = ($row =~ / ]*?>(.*?)<\/td>/g);
  
 
470 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 		if ($#cols >= 1 and $cols[1] =~ /]*?)">(.*)<\/a>/) {
   
 
471 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $item = {'link' => $self->absolute_url($1, $base), 'subject' => $self->rewrite($2)};
  
 
472 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$item->{'date'} = "${1}/${2}/${3}" if ($cols[0] =~ /(\d{4})年(\d{4})月(\d{4})日/);
  
 
473 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 			$item->{'delete_member'}  = {'link' => $self->absolute_url($1, $base), 'subject' => $self->rewrite($2)} if ($#cols >= 2 and $cols[2] =~ /]*?)">(.*)<\/a>/);
   
 
474 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 			$item->{'transfer_admin'} = {'link' => $self->absolute_url($1, $base), 'subject' => $self->rewrite($2)} if ($#cols >= 3 and $cols[3] =~ /]*?)">(.*)<\/a>/);
   
 
475 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			push(@items, $item);
  
 
476 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
477 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
478 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
479 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
480 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
481 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_edit_member_pages {
  
 
482 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
483 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
484 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
485 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
486 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $current = $res->request->uri->as_string;
  
 
487 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
488 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
489 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get page list part
  
 
490 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_from = qq(\Q\E[^\\[\\]]*\\[);
  
 
491 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_till = qq(\\][^\\[\\]]*\Q\E);
  
 
492 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] page list part is missing.\n") unless ($content =~ /$content_from(.*?)$content_till/s);
  
 
493 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
494 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse rows
  
 
495 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content =~ s/[\t\r\n]//g;
  
 
496 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	while ($content =~ s/ (?:]*)["']?>)?(\d+)(?:<\/a>)? / /) {
   
 
497 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $item = {'subject' => $self->rewrite($2)};
  
 
498 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$item->{'link'}    = ($1) ? $self->absolute_url($1, $base) : $current;
  
 
499 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$item->{'current'} = ($1) ? 0 : 1;
  
 
500 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		push(@items, $item);
  
 
501 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
502 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
503 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
504 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
505 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_bbs {
  
 
506 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
507 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
508 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
509 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
510 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
511 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
512 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get bbs list part
  
 
513 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_from = qq(\Q\E);
 
514 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_till = qq(\Q\E);
  
 
515 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] bbs list part is missing.\n") unless ($content =~ /$content_from(.*?)$content_till/s);
  
 
516 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
517 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get records
  
 
518 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $record_from = qq(\Q\E);
  
 
519 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $record_till = "\n\n<\/td>\n<\/tr>\n\n";
  
 
520 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @records = ($content =~ /$record_from(.*?)$record_till/isg);
  
 
521 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] no bbs records found.\n") unless (@records);
  
 
522 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse records
  
 
523 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_date = ' (\d{2})月(\d{2})日 ';
 
 
524 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_subj = '  (.+?) ';
 
 
525 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_thum = ' (.*?)  
';
  
 
526 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_desc = ' \n*(.*?)\n ';
 
 
527 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_name = '\((.*?)\)';
  
 
528 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_link = '書き込み\((\d+)\)<\/a>';
   
 
529 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $record (@records) {
  
 
530 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		unless ($record =~ /$re_date/is) { $self->log("[warn] time is not found.\n$record\n"); next; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
531 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $time = sprintf('%02d/%02d %02d:%02d', $1, $2, $3, $4);
  
 
532 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		unless ($record =~ /${re_subj}/is) { $self->log("[warn] subject is not found.\n$record\n"); next; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
533 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $subj = $1;
  
 
534 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		unless ($record =~ /${re_thum}/is) { $self->log("[warn] thums are not found.\n$record\n"); next; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
535 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $thumbs = $1;
  
 
536 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		unless ($record =~ /${re_desc}/is) { $self->log("[warn] desc is not found.\n$record\n"); next; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
537 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $desc = $1;
  
 
538 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		unless ($record =~ /${re_link}/is) { $self->log("[warn] link is not found.\n$record\n"); next; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
539 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my ($link, $count) = ($1, $2);
  
 
540 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$subj = $self->rewrite($subj);
  
 
541 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$desc = $self->rewrite($desc);
  
 
542 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$desc =~ s/^$//g;
  
 
543 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$link = $self->absolute_url($link, $base);
  
 
544 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @images = ();
  
 
545 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		while ($thumbs =~ s/MM_openBrWindow\('(.*?)',.+? 
 
546 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $img      = $self->absolute_url($1, $base);
  
 
547 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $thumbimg = $self->absolute_url($2, $base);
  
 
548 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			push(@images,  {'thumb_link' => $thumbimg, 'link' => $img});
  
 
549 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
550 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		push(@items, {'time' => $time, 'description' => $desc, 'subject' => $subj, 'link' => $link, 'count' => $count, 'images' => [@images]});
  
 
551 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
552 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
553 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
554 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
555 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_bbs_next {
  
 
556 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
557 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
558 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
559 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
560 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
561 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($content =~ / .*?]*?list_bbs.pl[^<>]*?)>([^<>]*?)<\/a><\/td>/);
   
 
562 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $subject = $2;
  
 
563 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $link    = $self->absolute_url($1, $base);
  
 
564 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $next    = {'link' => $link, 'subject' => $2};
  
 
565 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $next;
  
 
566 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
567 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
568 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_bbs_previous {
  
 
569 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
570 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
571 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
572 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
573 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
574 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($content =~ / ]*?list_bbs.pl[^<>]*?)>([^<>]*?)<\/a>/);
   
575 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $subject = $2;
  
 
576 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $link    = $self->absolute_url($1, $base);
  
 
577 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $next    = {'link' => $link, 'subject' => $2};
  
 
578 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $next;
  
 
579 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
580 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
581 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_bookmark {
  
 
582 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
583 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
584 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
585 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
586 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
587 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
588 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get bookmark list part
  
 
589 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_from = qq(\Q\E);
  
 
590 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_till = qq(\Q\E);
  
 
591 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] bookmark list part is missing.\n") unless ($content =~ /$content_from(.*?)$content_till/s);
  
 
592 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
593 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse rows
  
 
594 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $record_from = qq(\Q\E);
 
595 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $record_till = qq(\Q  
\E);
  
 
596 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @records = ($content =~ /$record_from(.*?)$record_till/isg);
  
 
597 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] no bookmark records found.\n") unless (@records);
  
 
598 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $record (@records) {
  
 
599 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $item = {};
  
 
600 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @lines = ($record =~ /  (.*?)<\/tr>/isg);
 
601 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if (@lines < 3) { $self->log("[warn] not enough rows are found in record.\n$record"); next; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
602 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @rows = map { [$_ =~ / ]*>(.*?)<\/td>/gis] } @lines[0..2];
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
603 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if (@{$rows[0]} < 3) { $self->log("[warn] not enough cols are found in first row.\n$lines[0]"); next; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
604 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if (@{$rows[1]} < 2) { $self->log("[warn] not enough cols are found in second row.\n$lines[1]"); next; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
605 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if (@{$rows[2]} < 2) { $self->log("[warn] not enough cols are found in third row.\n$lines[2]"); next; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
606 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @cols = @{$rows[0]};
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
607 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$item->{'link'} = ($cols[0] =~ /()/) ? $self->parse_standard_tag($1)->{'attr'}->{'href'} : $self->log("[warn] link is not found in the col.\n" . $cols[0]);
   
 
608 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$item->{'image'} = ($cols[0] =~ /( 
 
609 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$item->{'subject'} = (length($cols[2])) ? $cols[2] : $self->log("[warn] subject is not found in the col.\n" . $cols[2]);
  
 
610 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$item->{'gender'} = undef;
  
 
611 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		@cols = @{$rows[1]};
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
612 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$item->{'description'} = $cols[1];
  
 
613 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		@cols = @{$rows[2]};
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
614 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$item->{'time'} = $cols[1];
  
 
615 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		# format
  
 
616 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$item->{'description'} =~ s/(^\n+|\s+$)//gs;
  
 
617 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		foreach (qw(image link)) { $item->{$_} = $self->absolute_url($item->{$_}, $base) if ($item->{$_}); }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
618 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		foreach (qw(subject description)) { $item->{$_} = $self->rewrite($item->{$_}); }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
619 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$item->{'time'} = $self->convert_login_time($item->{'time'}) if ($item->{'time'});
  
 
620 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 		if (not $item->{'link'} or not $item->{'subject'}) { $item->{'record'} = $record, $self->log("[warn] not enough datas in record.\n$record"); next; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
621 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 		push(@items, $item) if ($item->{'subject'} and $item->{'link'});
  
 
622 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
623 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	@items = sort { $b->{'time'} cmp $a->{'time'} } @items;
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
624 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
625 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
626 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
627 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_comment {
  
 
628 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
629 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_standard_history(@_);
  
 
630 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
631 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
632 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_community {
  
 
633 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
634 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
635 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
636 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
637 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
638 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
639 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $status_backgrounds = {
  
 
640 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'bg_orange1-.gif' => '管理者',
  
 
641 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	};
  
 
642 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get community list part
  
 
643 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_from = qq(\Q\E);
 
644 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_till = qq(\Q  
\E);
  
 
645 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] community list part is missing.\n") unless ($content =~ /$content_from(.*?)$content_till/s);
  
 
646 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
647 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get community list rows
  
 
648 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @rows = ();
  
 
649 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	push(@rows, [$1, $2]) while ($content =~ s/  (.*?)<\/tr>\s* (.*?)<\/tr>//is);
 
 
650 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] community list has no rows.\n") unless (@rows);
  
 
651 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse each items
  
 
652 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $row (@rows) {
  
 
653 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my ($image_part, $text_part) = @{$row};
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
654 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @images = ($image_part =~ / ]*>.*?<\/td>/gis);
  
 
655 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @texts  = ($text_part =~ / ]*>(.*?)<\/td>/gis);
  
 
656 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		return $self->log("[warn] image is missing in image part.\n\t$image_part\n") unless (@images);
  
 
657 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		return $self->log("[warn] text is missing in text part.\n\t$text_part\n") unless (@texts);
  
 
658 
 
0
 
 
 
  
  0
   
 
 
 
 
 
 
 
 		for (my $i = 0; $i < @images or $i < @texts; $i++) {
  
 
659 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $item = {};
  
 
660 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my ($image, $text) = ($images[$i], $texts[$i]);
  
 
661 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			unless ($text =~ /^\s*([^\n]*)\((\d+)\)\n/) {
  
 
662 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 				$self->log("[warn] name or count is missing in text.\n\t$text\n") if ($i == 0);
  
 
663 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				last;
  
 
664 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
665 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			($item->{'subject'}, $item->{'count'}) = ($1, $2);
  
 
666 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			unless ($image =~ /( ]*>)\s*(]*>)\s*(  
 
667 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 				$self->log("[warn] td, a or img tag is missing in image.\n\t$image\n") if ($i == 0);
  
 
668 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				next;
  
 
669 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
670 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my @tags = ($1, $2, $3);
  
 
671 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my ($td, $a, $img) = map { $self->parse_standard_tag($_) } @tags;
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
672 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$item->{'background'} = $td->{'attr'}->{'background'} or return $self->log("[warn] background is missing in tag.\n\t$tags[0]\n");
  
 
673 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$item->{'link'} = $a->{'attr'}->{'href'} or return $self->log("[warn] link is missing in tag.\n\t$tags[1]\n");
  
 
674 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$item->{'image'} = $img->{'attr'}->{'src'} or return $self->log("[warn] image is missing in tag.\n\t$tags[2]\n");
  
 
675 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 			$item->{'status'} = ($item->{'background'} and $item->{'background'} =~ /([^\/]+)$/) ? $1 : undef;
  
 
676 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			if ($item->{'link'}) {
  
 
677 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$item->{'subject'}    = $self->rewrite($item->{'subject'});
  
 
678 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$item->{'link'}       = $self->absolute_url($item->{'link'}, $base);
  
 
679 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$item->{'image'}      = $self->absolute_url($item->{'image'}, $base);
  
 
680 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$item->{'background'} = $self->absolute_url($item->{'background'}, $base);
  
 
681 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$item->{'status'}     = $status_backgrounds->{$item->{'status'}};
  
 
682 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				push(@items, $item);
  
 
683 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
684 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
685 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
686 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
687 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
688 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
689 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_community_next {
  
 
690 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
691 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my ($res, $content, $url, $base) = $self->parse_parser_params(@_);
  
 
692 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
693 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] Page link part is missing.\n") unless ($content =~ s/^.*\Q\E(.*?)<\/table>.*$/$1/s);
 
694 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] Next page is not exists.\n")   unless ($content =~ /  (]*>)(.*?)<\/a>/);
   
 
695 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $subject = $self->rewrite($2);
  
 
696 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $tag     = $self->parse_standard_tag($1);
  
 
697 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $link    = $self->absolute_url($tag->{'attr'}->{'href'}, $base);
  
 
698 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $next    = {'link' => $link, 'subject' => $subject};
  
 
699 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $next;
  
 
700 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
701 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
702 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_community_previous {
  
 
703 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
704 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my ($res, $content, $url, $base) = $self->parse_parser_params(@_);
  
 
705 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
706 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] Page link part is missing.\n") unless ($content =~ s/^.*\Q\E(.*?)<\/table>.*$/$1/s);
 
707 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] Previous page is not exists.\n") unless ($content =~ /(]*>)(.*?)<\/a>  /);
   
 
708 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $subject = $self->rewrite($2);
  
 
709 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $tag     = $self->parse_standard_tag($1);
  
 
710 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $link    = $self->absolute_url($tag->{'attr'}->{'href'}, $base);
  
 
711 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $previous = {'link' => $link, 'subject' => $subject};
  
 
712 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $previous;
  
 
713 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
714 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
715 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_diary {
  
 
716 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
717 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
718 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
719 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
720 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
721 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
722 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_date = ' ]*>(\d{4})年 .*? ';
 
 
723 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_subj = '  (.+?) ';
 
 
724 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_desc = ' \n(?:(.*?)<\/table>)?\n(.+?)\n
725 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_link = '続きはこちら<\/a>';
   
 
726 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_comm = 'コメント\((\d+)\)<\/a>';
   
 
727 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get diary list part
  
 
728 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_from = qq(\Q\E);
 
729 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_till = qq(\Q\E);
 
730 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] diary list part is missing.\n") unless ($content =~ /$content_from(.*?)$content_till/s);
  
 
731 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
732 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get diary list items
  
 
733 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @rows = ();
  
 
734 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	push(@rows, $1) while ($content =~ s/  (.*?)( |<\/table>\s*$)/$2/is);
 
 
735 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] diary list has no rows.\n") unless (@rows);
  
 
736 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse each items
  
 
737 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $row (@rows) {
  
 
738 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $row_org = $row;
  
 
739 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my $time  = ($row =~ s/$re_date//is) ? sprintf('%04d/%02d/%02d %02d:%02d', $1, $2, $3, $4, $5) : $self->log("[warn] row does not match re_date.");
  
 
740 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my $subj  = ($row =~ s/$re_subj//is) ? $1 : $self->log("[warn] row does not match re_subj.");
  
 
741 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my ($thumbs, $desc) = ($row =~ s/$re_desc//is) ? ($1, $2) : $self->log("[warn] row does not match re_desc.");
  
 
742 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my $count = ($row =~ s/$re_comm//is) ? $1 : $self->log("[warn] row does not match re_comm.");
  
 
743 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my $link  = ($row =~ s/$re_link//is) ? $1 : $self->log("[warn] row does not match re_link.");
  
 
744 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if (scalar(grep { not defined($_) } ($time, $subj, $desc, $link, $count))) {
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
745 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$self->log($row_org);
  
 
746 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			next;
  
 
747 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
748 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$subj = $self->rewrite($subj);
  
 
749 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$desc = $self->rewrite($desc);
  
 
750 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$desc =~ s/^$//g;
  
 
751 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$link = $self->absolute_url($link, $base);
  
 
752 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @images = ();
  
 
753 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		while ($thumbs =~ s/MM_openBrWindow\('(.*?)',.+? 
 
754 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $img      = $self->absolute_url($1, $base);
  
 
755 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $thumbimg = $self->absolute_url($2, $base);
  
 
756 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			push(@images,  {'thumb_link' => $thumbimg, 'link' => $img});
  
 
757 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
758 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		push(@items, {'time' => $time, 'description' => $desc, 'subject' => $subj, 'link' => $link, 'count' => $count, 'images' => [@images]});
  
 
759 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
760 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
761 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
762 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
763 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_diary_capacity {
  
 
764 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self     = shift;
  
 
765 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res      = (@_) ? shift : $self->response();
  
 
766 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
767 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base     = $res->request->uri->as_string;
  
 
768 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content  = $res->content;
  
 
769 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($content =~ /(.*?)<\/table>/is);
 
770 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $box      = $1;
  
 
771 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($box =~ /(\d+\.\d+).*?MB\/.*?(\d+\.\d+).*?MB/);
  
 
772 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $capacity = {'used' => $1, 'max' => $2};
  
 
773 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $capacity;
  
 
774 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
775 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
776 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_diary_next {
  
 
777 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
778 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
779 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
780 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
781 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
782 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($content =~ / .*?]*?list_diary.pl[^<>]*?)>([^<>]*?)<\/a><\/td>/);
   
 
783 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $subject = $2;
  
 
784 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $link    = $self->absolute_url($1, $base);
  
 
785 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $next    = {'link' => $link, 'subject' => $2};
  
 
786 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $next;
  
 
787 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
788 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
789 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_diary_previous {
  
 
790 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
791 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
792 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
793 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
794 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
795 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($content =~ / ]*?list_diary.pl[^<>]*?)>([^<>]*?)<\/a>/);
   
796 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $subject = $2;
  
 
797 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $link    = $self->absolute_url($1, $base);
  
 
798 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $next    = {'link' => $link, 'subject' => $2};
  
 
799 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $next;
  
 
800 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
801 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
802 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_diary_monthly_menu {
  
 
803 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
804 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
805 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
806 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
807 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
808 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
809 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get monthly menu part
  
 
810 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_from = qq( 
 
811 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_till = qq(\Q  
\E);
  
 
812 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] monthly menu part is missing.\n") unless ($content =~ /$content_from(.*?)$content_till/s);
  
 
813 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
814 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get monthly menu items
  
 
815 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @rows = ($content =~ /(]*>)/gis);
   
 
816 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] monthly meny has no rows.\n") unless (@rows);
  
 
817 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse monthly menu
  
 
818 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $row (@rows) {
  
 
819 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $anchor = $self->parse_standard_tag($row);
  
 
820 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $link   = $anchor->{'attr'}->{'href'};
  
 
821 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my $year   = $1 if ($link =~ /year=(\d+)/i);
  
 
822 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my $month  = $1 if ($link =~ /month=(\d+)/i);
  
 
823 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 		push(@items, {'link' => $self->absolute_url($link, $base), 'year' => $year, 'month' => $month}) if ($link and $year and $month);
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
824 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
825 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
826 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
827 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
828 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_friend {
  
 
829 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
830 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
831 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
832 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
833 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
834 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
835 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $status_backgrounds = {
  
 
836 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'bg_orange1-.gif' => '1時間以内',
  
 
837 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'bg_orange2-.gif' => '1日以内',
  
 
838 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	};
  
 
839 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @time1   = reverse((localtime(time - 3600))[0..5]);
  
 
840 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @time2   = reverse((localtime(time - 3600 * 24))[0..5]);
  
 
841 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get friend list part
  
 
842 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_from = qq(\Q\E);
 
843 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_till = qq(\Q  
\E);
  
 
844 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] friend list part is missing.\n") unless ($content =~ /$content_from(.*?)$content_till/s);
  
 
845 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
846 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get friend list rows
  
 
847 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @rows = ();
  
 
848 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	push(@rows, [$1, $2]) while ($content =~ s/\Q  \E(.*?)<\/tr>\s*\Q \E(.*?)<\/tr>//is);
 
 
849 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] friend list has no rows.\n") unless (@rows);
  
 
850 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse each items
  
 
851 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $row (@rows) {
  
 
852 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my ($image_part, $text_part) = @{$row};
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
853 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @images = ($image_part =~ / ]*>.*?<\/td>/gis);
  
 
854 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @texts  = ($text_part =~ / ]*>(.*?)<\/td>/gis);
  
 
855 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		return $self->log("[warn] image is missing in image part.\n\t$image_part\n") unless (@images);
  
 
856 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		return $self->log("[warn] text is missing in text part.\n\t$text_part\n") unless (@texts);
  
 
857 
 
0
 
 
 
  
  0
   
 
 
 
 
 
 
 
 		for (my $i = 0; $i < @images or $i < @texts; $i++) {
  
 
858 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $item = {};
  
 
859 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my ($image, $text) = ($images[$i], $texts[$i]);
  
 
860 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			last if ($text eq ' 
 
861 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$text =~ /^\s*([^<>]*)\((\d+)\)\s*(?: 
 
862 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			($item->{'subject'}, $item->{'count'}) = ($1, $2);
  
 
863 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$image =~ /( ]*>)\s*(]*>)\s*(  
 
864 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my @tags = ($1, $2, $3);
  
 
865 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my ($td, $a, $img) = map { $self->parse_standard_tag($_) } @tags;
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
866 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$item->{'background'} = $td->{'attr'}->{'background'} or return $self->log("[warn] background is missing in tag.\n\t$tags[0]\n");
  
 
867 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$item->{'link'} = $a->{'attr'}->{'href'} or return $self->log("[warn] link is missing in tag.\n\t$tags[1]\n");
  
 
868 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$item->{'image'} = $img->{'attr'}->{'src'} or return $self->log("[warn] image is missing in tag.\n\t$tags[2]\n");
  
 
869 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 			$item->{'status'} = ($item->{'background'} and $item->{'background'} =~ /([^\/]+)$/) ? $1 : undef;
  
 
870 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			if ($item->{'link'}) {
  
 
871 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$item->{'subject'}    = $self->rewrite($item->{'subject'});
  
 
872 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$item->{'link'}       = $self->absolute_url($item->{'link'}, $base);
  
 
873 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 				$item->{'id'}         = $2 if ($item->{'link'} =~ /(.*?)?id=(\d*)/); 
  
 
874 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$item->{'image'}      = $self->absolute_url($item->{'image'}, $base);
  
 
875 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$item->{'background'} = $self->absolute_url($item->{'background'}, $base);
  
 
876 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$item->{'status'}     = $status_backgrounds->{$item->{'status'}};
  
 
877 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				push(@items, $item);
  
 
878 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
879 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
880 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
881 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
882 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
883 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
884 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_friend_next {
  
 
885 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
886 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
887 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
888 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
889 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
890 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($content =~ /  ]*?list_friend.pl\?[^<>\s]*page=[^<>\s]*)>((?:(?!<\/a>).)*)<\/a>/);
   
 
891 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $subject = $2;
  
 
892 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $link    = $self->absolute_url($1, $base);
  
 
893 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $next    = {'link' => $link, 'subject' => $2};
  
 
894 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $next;
  
 
895 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
896 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
897 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_friend_previous {
  
 
898 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self     = shift;
  
 
899 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res      = (@_) ? shift : $self->response();
  
 
900 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
901 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base     = $res->request->uri->as_string;
  
 
902 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content  = $res->content;
  
 
903 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($content =~ /\s]*list_friend.pl\?[^<>\s]*page=[^<>\s]*)>((?:(?!<\/a>).)*)<\/a>  /);
   
 
904 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $subject  = $2;
  
 
905 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $link     = $self->absolute_url($1, $base);
  
 
906 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $previous = {'link' => $link, 'subject' => $2};
  
 
907 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $previous;
  
 
908 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
909 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
910 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_member {
  
 
911 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
912 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
913 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
914 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
915 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
916 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
917 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get member list part
  
 
918 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_from = "\Q\E";
 
919 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_till = "\Q  
\E";
  
 
920 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] member list part is missing.\n") unless ($content =~ /$content_from(.+?)$content_till/s);
  
 
921 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
922 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get member list rows
  
 
923 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @rows = ();
  
 
924 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	push(@rows, [$1, $2]) while ($content =~ s/  (.*?)<\/tr>\s* (.*?)<\/tr>//is);
 
 
925 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] no rows found in member list part.\n") unless (@rows);
  
 
926 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse each items
  
 
927 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $row (@rows) {
  
 
928 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my ($image_part, $text_part) = @{$row};
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
929 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @images = ($image_part =~ / ]*>.*?<\/td>/gis);
  
 
930 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @texts  = ($text_part =~ / ]*>(.*?)<\/td>/gis);
  
 
931 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		return $self->log("[warn] image is missing in image part.\n\t$image_part\n") unless (@images);
  
 
932 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		return $self->log("[warn] text is missing in text part.\n\t$text_part\n") unless (@texts);
  
 
933 
 
0
 
 
 
  
  0
   
 
 
 
 
 
 
 
 		for (my $i = 0; $i < @images or $i < @texts; $i++) {
  
 
934 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $item = {};
  
 
935 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my ($image, $text) = ($images[$i], $texts[$i]);
  
 
936 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			unless ($text =~ /^\s*([^<>]*)\((\d+)\)\s*$/) {
  
 
937 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 				$self->log("[warn] name or count is missing in text.\n\t$text\n") if ($i == 0);
  
 
938 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				last;
  
 
939 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
940 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			($item->{'subject'}, $item->{'count'}) = ($1, $2);
  
 
941 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			unless ($image =~ /( ]*>)\s*(]*>)\s*(  
 
942 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 				$self->log("[warn] td, a or img tag is missing in image.\n\t$image\n") if ($i == 0);
  
 
943 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				next;
  
 
944 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
945 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my @tags = ($1, $2, $3);
  
 
946 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my ($td, $a, $img) = map { $self->parse_standard_tag($_) } @tags;
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
947 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$item->{'background'} = $td->{'attr'}->{'background'} or return $self->log("[warn] background is missing in tag.\n\t$tags[0]\n");
  
 
948 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$item->{'link'} = $a->{'attr'}->{'href'} or return $self->log("[warn] link is missing in tag.\n\t$tags[1]\n");
  
 
949 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$item->{'image'} = $img->{'attr'}->{'src'} or return $self->log("[warn] image is missing in tag.\n\t$tags[2]\n");
  
 
950 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 			$item->{'status'} = ($item->{'background'} and $item->{'background'} =~ /([^\/]+)$/) ? $1 : undef;
  
 
951 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			if ($item->{'link'}) {
  
 
952 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$item->{'subject'}    = $self->rewrite($item->{'subject'});
  
 
953 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$item->{'link'}       = $self->absolute_url($item->{'link'}, $base);
  
 
954 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$item->{'image'}      = $self->absolute_url($item->{'image'}, $base);
  
 
955 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$item->{'background'} = $self->absolute_url($item->{'background'}, $base);
  
 
956 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 				$item->{'id'}         = $1 if ($item->{'link'} =~ /\bid=(\d+)/); 
  
 
957 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				push(@items, $item);
  
 
958 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
959 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
960 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
961 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
962 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
963 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
964 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_member_next {
  
 
965 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
966 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
967 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
968 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
969 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
970 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($content =~ /  ]*?list_member.pl\?[^<>\s]*page=[^<>\s]*)>((?:(?!<\/a>).)*)<\/a>/);
   
 
971 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $subject = $2;
  
 
972 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $link    = $self->absolute_url($1, $base);
  
 
973 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $next    = {'link' => $link, 'subject' => $2};
  
 
974 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $next;
  
 
975 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
976 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
977 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_member_previous {
  
 
978 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self     = shift;
  
 
979 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res      = (@_) ? shift : $self->response();
  
 
980 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
981 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base     = $res->request->uri->as_string;
  
 
982 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content  = $res->content;
  
 
983 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($content =~ /\s]*list_member.pl\?[^<>\s]*page=[^<>\s]*)>((?:(?!<\/a>).)*)<\/a>  /);
   
 
984 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $subject  = $2;
  
 
985 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $link     = $self->absolute_url($1, $base);
  
 
986 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $previous = {'link' => $link, 'subject' => $2};
  
 
987 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $previous;
  
 
988 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
989 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
990 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_message {
  
 
991 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self      = shift;
  
 
992 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res       = (@_) ? shift : $self->response();
  
 
993 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
994 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base      = $res->request->uri->as_string;
  
 
995 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content   = $res->content;
  
 
996 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items     = ();
  
 
997 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $img_rep   = $self->absolute_url('img/mail5.gif', $base);
  
 
998 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %emvelopes = (
  
 
999 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		$self->absolute_url('img/mail1.gif', 'http://img.mixi.jp/') => 'new',
  
 
1000 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		$self->absolute_url('img/mail2.gif', 'http://img.mixi.jp/') => 'opened',
  
 
1001 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		$self->absolute_url('img/mail5.gif', 'http://img.mixi.jp/') => 'replied',
  
 
1002 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	);
  
 
1003 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_link   = '(.+?)<\/a>';
   
 
1004 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($content =~ /.*?(.+?)<\/table>/s) {
 
1005 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$content = $1;
  
 
1006 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		while ($content =~ s/  (.*?)<\/tr>//s) {
 
 
1007 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $message  = $2;
  
 
1008 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			my $emvelope = ($message =~ s/ ]*>\s* 
 
1009 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			my $status   = $emvelopes{$emvelope} ? $emvelopes{$emvelope} : 'unknown';
  
 
1010 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			if ($message =~ / ([^<>]*?)<\/td>\s* ${re_link}<\/td>\s* (\d{2})月(\d{2})日<\/td>/is) {
  
 
1011 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				my ($name, $link, $subj) = ($1, $2, $3);
  
 
1012 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				my $time = sprintf('%02d/%02d', $4, $5);
  
 
1013 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				my $item = {
  
 
1014 
 
 
 
 
 
 
 
 
 
 
 
 
 
 					'time'     => $time,
  
 
1015 
 
 
 
 
 
 
 
 
 
 
 
 
 
 					'subject'  => $self->rewrite($subj),
  
 
1016 
 
 
 
 
 
 
 
 
 
 
 
 
 
 					'name'     => $self->rewrite($name),
  
 
1017 
 
 
 
 
 
 
 
 
 
 
 
 
 
 					'link'     => $self->absolute_url($link, $base),
  
 
1018 
 
 
 
 
 
 
 
 
 
 
 
 
 
 					'status'   => $status,
  
 
1019 
 
 
 
 
 
 
 
 
 
 
 
 
 
 					'emvelope' => $emvelope,
  
 
1020 
 
 
 
 
 
 
 
 
 
 
 
 
 
 				};
  
 
1021 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				push(@items, $item);
  
 
1022 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
1023 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
1024 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1025 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1026 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1027 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1028 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_outbox {
  
 
1029 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self      = shift;
  
 
1030 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res       = (@_) ? shift : $self->response();
  
 
1031 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1032 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base      = $res->request->uri->as_string;
  
 
1033 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content   = $res->content;
  
 
1034 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items     = ();
  
 
1035 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_link   = '(.+?)<\/a>';
   
 
1036 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($content =~ /.*?(.+?)<\/table>/s) {
 
1037 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$content = $1;
  
 
1038 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		while ($content =~ s/  (.*?)<\/tr>//s) {
 
 
1039 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $message  = $2;
  
 
1040 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			if ($message =~ / ([^<>]*?)<\/td>\s* ${re_link}<\/td>\s* (\d{2})月(\d{2})日<\/td>/is) {
  
 
1041 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				my ($name, $link, $subj) = ($1, $2, $3);
  
 
1042 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				my $time = sprintf('%02d/%02d', $4, $5);
  
 
1043 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				my $item = {
  
 
1044 
 
 
 
 
 
 
 
 
 
 
 
 
 
 					'time'     => $time,
  
 
1045 
 
 
 
 
 
 
 
 
 
 
 
 
 
 					'subject'  => $self->rewrite($subj),
  
 
1046 
 
 
 
 
 
 
 
 
 
 
 
 
 
 					'name'     => $self->rewrite($name),
  
 
1047 
 
 
 
 
 
 
 
 
 
 
 
 
 
 					'link'     => $self->absolute_url($link, $base),
  
 
1048 
 
 
 
 
 
 
 
 
 
 
 
 
 
 				};
  
 
1049 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				push(@items, $item);
  
 
1050 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
1051 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
1052 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1053 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1054 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1055 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1056 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_request {
  
 
1057 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1058 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
1059 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1060 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
1061 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
1062 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
1063 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get requests
  
 
1064 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @records = ($content =~ /(.*?)<\/table>/isg);
   
 
1065 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[info] No request found.\n") if (not @records);
  
 
1066 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse requests
  
 
1067 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $record (@records) {
  
 
1068 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $item   = {};
  
 
1069 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $record = $1;
  
 
1070 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$record    =~ s/^.*]*>//is;
 
1071 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @lines  = ($record =~ /  (.*?)<\/tr>/gis);
 
1072 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if (@lines < 4) { $self->log("[warn] not enough rows are found in record.\n$record"); next; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1073 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @rows = map { [$_ =~ / ]*>(.*?)<\/td>/gis] } @lines[0..3];
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1074 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if (@{$rows[0]} < 3) { $self->log("[warn] not enough cols are found in first row.\n$lines[0]"); next; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1075 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if (@{$rows[1]} < 2) { $self->log("[warn] not enough cols are found in second row.\n$lines[1]"); next; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1076 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if (@{$rows[2]} < 2) { $self->log("[warn] not enough cols are found in third row.\n$lines[2]"); next; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1077 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if (@{$rows[3]} < 3) { $self->log("[warn] not enough cols are found in fourth row.\n$lines[3]"); next; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1078 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @cols = @{$rows[0]};
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1079 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$item->{'link'} = ($cols[0] =~ /()/) ? $self->parse_standard_tag($1)->{'attr'}->{'href'} : $self->log("[warn] link is not found in the col.\n" . $cols[0]);
   
 
1080 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$item->{'image'} = ($cols[0] =~ /( 
 
1081 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$item->{'subject'} = ($cols[2] =~ /(.*?)<\/a>/i) ? $1 : $self->log("[warn] subject is not found in the col.\n" . $cols[2]);
   
 
1082 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$item->{'gender'} = undef;
  
 
1083 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		@cols = @{$rows[1]};
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1084 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$item->{'description'} = $cols[1];
  
 
1085 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		@cols = @{$rows[2]};
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1086 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$item->{'message'} = $cols[1];
  
 
1087 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		@cols = @{$rows[3]};
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1088 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$item->{'time'} = $cols[1];
  
 
1089 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$item->{'button'} = [];
  
 
1090 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		foreach my $button ($cols[2] =~ /]*>.*?<\/a>/gis) {
   
 
1091 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			my $link  = ($button =~ /()/)   ? $self->parse_standard_tag($1) : $self->log("[warn] link is not found in the button.\n$button");
   
 
1092 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			my $image = ($button =~ /( 
 
1093 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$button   = { 'link' => $link->{'attr'}->{'href'}, 'image' => $image->{'attr'}->{'src'}, 'title' => $image->{'attr'}->{'alt'} };
  
 
1094 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			map { $button->{$_} = $self->absolute_url($button->{$_}, $base) } qw(link image);
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1095 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			map { $button->{$_} = $self->rewrite($button->{$_}, $base) }      qw(title);
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1096 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$item->{'button'} = [] unless ($item->{'button'});
  
 
1097 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			push(@{$item->{'button'}}, $button);
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1098 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
1099 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		# format
  
 
1100 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		map { $item->{$_} = $self->absolute_url($item->{$_}, $base) } qw(link image);
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1101 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		map { $item->{$_} = $self->rewrite($item->{$_}, $base) }      qw(subject description message);
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1102 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$item->{'time'} = $self->convert_login_time($item->{'time'}) if ($item->{'time'});
  
 
1103 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 		push(@items, $item) if ($item->{'subject'} and $item->{'link'});
  
 
1104 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1105 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	@items = sort { $b->{'time'} cmp $a->{'time'} } @items;
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1106 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1107 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1108 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1109 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 sub parse_new_album        { &parse_standard_history(@_); }
  
 
1110 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 sub parse_new_bbs          { &parse_standard_history(@_); }
  
 
1111 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 sub parse_new_bbs_next     { &parse_standard_history_next(@_); }
  
 
1112 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 sub parse_new_bbs_previous { &parse_standard_history_previous(@_); }
  
 
1113 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 sub parse_new_comment      { &parse_standard_history(@_); }
  
 
1114 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 sub parse_new_friend_diary { &parse_standard_history(@_); }
  
 
1115 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 sub parse_new_friend_diary_next { &parse_standard_history_next(@_); }
  
 
1116 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 sub parse_new_friend_diary_previous { &parse_standard_history_previous(@_); }
  
 
1117 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 sub parse_new_review       { &parse_standard_history(@_); }
  
 
1118 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1119 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_release_info {
  
 
1120 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self     = shift;
  
 
1121 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res      = (@_) ? shift : $self->response();
  
 
1122 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1123 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base     = $res->base->as_string;
  
 
1124 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content  = $res->content;
  
 
1125 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items    = ();
  
 
1126 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_subj  = '(.+?)  
 
1127 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_date  = ' (\d{4}).(\d{2}).(\d{2})  
1128 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_desc  = ' (.*?) ';
 
 
1129 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($content =~ /新機能リリース・障害のご報告(.*?)/s) {
  
 
1130 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$content = $1;
  
 
1131 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		while ($content =~ s/.*?${re_subj}.*?${re_date}.*?${re_desc}.*?//is) {
 
1132 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $subj = $1;
  
 
1133 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $date = sprintf('%04d/%02d/%02d', $2, $3, $4);
  
 
1134 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $desc = $5;
  
 
1135 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$subj = $self->rewrite($subj);
  
 
1136 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$desc = $self->rewrite($desc);
  
 
1137 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$desc =~ s/^$//g;
  
 
1138 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			push(@items, {'time' => $date, 'description' => $desc, 'subject' => $subj});
  
 
1139 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
1140 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1141 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1142 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1143 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1144 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_self_id {
  
 
1145 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1146 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $session = $self->session;
  
 
1147 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return ($session and $session =~ /^(\d+)_/) ? $1 : 0;
  
 
1148 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1149 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1150 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_search_diary {
  
 
1151 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1152 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
1153 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1154 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
1155 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
1156 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
1157 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @time    = localtime();
  
 
1158 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my ($month, $year) = ($time[4] + 1, $time[5] + 1900);
  
 
1159 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($content =~ m{(.+?)}s) {
  
 
1160 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$content = $1;
  
 
1161 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		while ($content =~ s/(.*?)<\/table>//is) {
 
1162 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $record = $1;
  
 
1163 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my @lines = ($record =~ /  (.*?)<\/tr>/gis);
 
1164 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $item = {};
  
 
1165 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			# parse record
  
 
1166 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			($item->{'link'}, $item->{'image'})  = ($1, $2) if ($lines[0] =~ /  
1167 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			($item->{'name'}, $item->{'gender'}) = ($1, $2) if ($lines[0] =~ / ([^<>\n]*)/is);
  
 
1168 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$item->{'subject'} = $1 if ($lines[1] =~ / (.*?)<\/td>/is);
  
 
1169 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$item->{'description'} = $1 if ($lines[2] =~ / (.*?)<\/td>/is);
  
 
1170 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$item->{'time'}    = $1 if ($lines[3] =~ / (.*?)<\/td>/is);
  
 
1171 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			# format
  
 
1172 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my @time = ($item->{'time'} =~ /\d+/g);
  
 
1173 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			unshift(@time, ($time[0] == $month) ? $year : $year - 1) if (@time == 4);
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
1174 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$item->{'time'} = (@time == 5) ? sprintf('%04d/%02d/%02d %02d:%02d', @time) : '';
  
 
1175 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			foreach (qw(image link)) { $item->{$_} = $self->absolute_url($item->{$_}, $base) if ($item->{$_}); }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1176 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			foreach (qw(name subject description gender time)) {
  
 
1177 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 				$item->{$_} =~ s/<.*?>//g if ($item->{$_});
  
 
1178 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$item->{$_} = $self->rewrite($item->{$_});
  
 
1179 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
1180 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 			push(@items, $item) if ($item->{'subject'} and $item->{'link'});
  
 
1181 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
1182 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1183 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1184 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1185 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1186 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_search_diary_next {
  
 
1187 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1188 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
1189 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1190 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
1191 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
1192 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($content =~ / .*?]*?search_diary.pl[^<>]*?)>([^<>]*?)<\/a><\/td>/);
   
 
1193 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $subject = $2;
  
 
1194 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $link    = $self->absolute_url($1, $base);
  
 
1195 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $next    = {'link' => $link, 'subject' => $2};
  
 
1196 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $next;
  
 
1197 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1198 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1199 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_search_diary_previous {
  
 
1200 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1201 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
1202 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1203 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
1204 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
1205 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($content =~ / ]*?search_diary.pl[^<>]*?)>([^<>]*?)<\/a>/);
   
1206 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $subject = $2;
  
 
1207 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $link    = $self->absolute_url($1, $base);
  
 
1208 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $next    = {'link' => $link, 'subject' => $2};
  
 
1209 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $next;
  
 
1210 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1211 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1212 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_show_calendar {
  
 
1213 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self     = shift;
  
 
1214 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res      = (@_) ? shift : $self->response();
  
 
1215 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1216 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base     = $res->base->as_string;
  
 
1217 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content  = $res->content;
  
 
1218 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %icons    = ('i_sc-.gif' => '予定', 'i_bd.gif' => '誕生日', 'i_iv1.gif' => '参加イベント', 'i_iv2.gif' => 'イベント');
  
 
1219 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %whethers = ('1' => '晴', '2' => '曇', '3' => '雨', '4' => '雪', '8' => 'のち', '9' => 'ときどき');
  
 
1220 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items    = ();
  
 
1221 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $term     = $self->parse_show_calendar_term($res) or return undef; 
  
 
1222 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get calendar part
  
 
1223 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_from = qq(\Q\E);
 
1224 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_till = qq(\Q  
\E);
  
 
1225 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] calendar part is missing.\n") unless ($content =~ /$content_from(.*?)$content_till/s);
  
 
1226 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
1227 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse main menu items
  
 
1228 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @days = ();
  
 
1229 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content =~ s/  .*?<\/tr>//is;
 
 
1230 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	push(@days, [$1, $2]) while ($content =~ s/ ]*>\s*(\d+)\s*<\/font>(.*?)<\/td>//is);
   
 
1231 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] no day found in calendar.\n") unless (@days);
  
 
1232 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse each days
  
 
1233 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $day (@days) {
  
 
1234 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my ($date, $text) = @{$day};
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1235 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$date = sprintf('%04d/%02d/%02d', $term->{'year'}, $term->{'month'}, $date);
  
 
1236 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if ($text =~ s/ 
 
1237 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $item = { 'subject' => "天気", 'link' => undef, 'name' => $2, 'time' => $date, 'icon' => $1};
  
 
1238 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$item->{'icon'} = $self->absolute_url($item->{'icon'}, $base);
  
 
1239 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			my $weather = ($item->{'icon'} =~ /i_w(\d+).gif$/) ? $1 : '不明';
  
 
1240 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$weather    =~ s/(\d)/$whethers{$1}/g;
  
 
1241 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$item->{'name'} = sprintf("%s(%s%%)", $weather, $self->rewrite($item->{'name'}));
  
 
1242 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			push(@items, $item);
  
 
1243 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
1244 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @events = split(/ 
 
1245 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		foreach my $event (@events) {
  
 
1246 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $item = {};
  
 
1247 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			if ($event =~ /(.*?)<\/a>/i) {
   
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
1248 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$item = { 'subject' => $1, 'link' => $2, 'name' => $3, 'time' => $date, 'icon' => $1};
  
 
1249 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			} elsif ($event =~ / 
 
1250 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$item = { 'subject' => $2, 'link' => $1, 'name' => $3, 'time' => $date, 'icon' => $2};
  
 
1251 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			} else {
  
 
1252 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				next;
  
 
1253 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
1254 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 			$item->{'subject'} = ($item->{'subject'} =~ /([^\/]+)$/ and $icons{$1}) ? $icons{$1} : "不明($1)";
  
 
1255 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$item->{'link'} = $self->absolute_url($item->{'link'}, $base);
  
 
1256 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$item->{'icon'} = $self->absolute_url($item->{'icon'}, $base);
  
 
1257 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$item->{'subject'} = $self->rewrite($item->{'subject'});
  
 
1258 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$item->{'name'} = $self->rewrite($item->{'name'});
  
 
1259 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			push(@items, $item);
  
 
1260 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
1261 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1262 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1263 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1264 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1265 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_show_calendar_term {
  
 
1266 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1267 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
1268 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1269 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
1270 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
1271 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($content =~ /[^&]*?<\/a>/);
   
 
1272 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return {'year' => $1, 'month' => $2};
  
 
1273 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1274 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1275 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_show_calendar_next {
  
 
1276 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1277 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
1278 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1279 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
1280 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
1281 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($content =~ /([^<>]+?) >>/);
   
 
1282 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $subject = $2;
  
 
1283 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $link    = $self->absolute_url($1, $base);
  
 
1284 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $next    = {'link' => $link, 'subject' => $subject};
  
 
1285 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $next;
  
 
1286 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1287 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1288 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_show_calendar_previous {
  
 
1289 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1290 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
1291 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1292 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
1293 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
1294 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($content =~ /<< ([^<>]+)/);
   
 
1295 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $subject = $2;
  
 
1296 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $link    = $self->absolute_url($1, $base);
  
 
1297 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $next    = {'link' => $link, 'subject' => $subject};
  
 
1298 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $next;
  
 
1299 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1300 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1301 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_show_friend_outline {
  
 
1302 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self     = shift;
  
 
1303 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res      = (@_) ? shift : $self->response();
  
 
1304 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1305 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base     = $res->request->uri->as_string;
  
 
1306 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content  = $res->content;
  
 
1307 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $outline  = {'link' => $base};
  
 
1308 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($content =~ / 
 
1309 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
1310 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse relation
  
 
1311 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($content =~ s/ (.*?)//s) {
 
1312 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $relation_part = $1;
  
 
1313 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @nodes = ($relation_part =~ /(.*?<\/a>)/g);
   
 
1314 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$outline->{'step'} = @nodes;
  
 
1315 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if ($outline->{'step'} == 2) {
  
 
1316 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			if ($nodes[0] =~ /(.+?)<\/a>/) {
   
 
1317 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				my ($link, $name) = ($1, $2);
  
 
1318 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$outline->{'relation'} = { 'link' => $self->absolute_url($link, $base), 'name' => $self->rewrite($name) };
  
 
1319 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			} else {
  
 
1320 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$outline->{'relation'} = { 'link' => '', 'name' => '' };
  
 
1321 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
1322 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
1323 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1324 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse image
  
 
1325 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($content =~ s/(.*?)<\/table>//s) {
 
1326 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $image_part = $1;
  
 
1327 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$outline->{'image'} = ($image_part =~ s/ 
 
1328 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1329 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse nickname
  
 
1330 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($content =~ s/([^\n]+)さん\((\d+)\)\((.*?)\)<\/span>  
 
1331 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my ($name, $count, $desc) = ($1, $2, $3);
  
 
1332 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$outline->{'name'} = $self->rewrite($name);
  
 
1333 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$outline->{'count'} = $count;
  
 
1334 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$outline->{'description'} = $self->rewrite($desc);
  
 
1335 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1336 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $outline;
  
 
1337 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1338 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1339 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_show_friend_profile {
  
 
1340 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1341 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
1342 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1343 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
1344 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
1345 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $profile = {};
  
 
1346 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_link = '(.+?)<\/a>';
   
 
1347 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($content = ($content =~ /(.+?)/s) ? $1 : '');
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
1348 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($content = ($content =~ /(.+?)/s) {
 
1374 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$content = $1;
  
 
1375 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		while ($content =~ s/  .*?\n(.*?)\n(.*?)<\/td>//is) {
  
 
1376 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my ($link, $img, $name, $rel, $desc) = ($1, $2, $3, $4, $5);
  
 
1377 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$rel =~ s/関係:(.+?) 
 
1378 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			my $intro = ($desc =~ /edit_intro.pl\?id=.+?\&type=edit/) ? "1" : "0";
  
 
1379 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			my $delete = ($desc =~ s/削除<\/a>//s) ? "1" : "0";
   
 
1380 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$name = $self->rewrite($name);
  
 
1381 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$rel  = $self->rewrite($rel);
  
 
1382 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$desc = $self->rewrite($desc);
  
 
1383 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$desc =~ s/この友人を紹介する//;
  
 
1384 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$desc =~ s/[\r\n]+//ig;
  
 
1385 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$link = $self->absolute_url($link, $base);
  
 
1386 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $item = {'link' => $link, 'name' => $name, 'image' => $img, 'relation' => $rel, 'description' => $desc, 'introduction' => $intro, 'detele' => $delete};
  
 
1387 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			push(@items, $item);
  
 
1388 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
1389 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1390 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1391 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1392 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1393 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_show_log {
  
 
1394 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1395 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
1396 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1397 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
1398 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
1399 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
1400 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_date = '(\d{4})年(\d{2})月(\d{2})日 (\d{1,2}):(\d{2})';
  
 
1401 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_link = '(.+?)<\/a>';
   
 
1402 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get log part
  
 
1403 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_from = qq(\Q 
 
1404 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_till = qq(\Q\E);
  
 
1405 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] log part is missing.\n") unless ($content =~ /$content_from(.*?)$content_till/s);
  
 
1406 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
1407 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse main menu items
  
 
1408 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @lines = ($content =~ /]*>(.*?)<\/li>/gs);
   
 
1409 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] no log found in log part.\n") unless (@lines);
  
 
1410 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse each items
  
 
1411 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $line (@lines) {
  
 
1412 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$line =~ /${re_date} (]*>)(.*)<\/a>/ or return $self->log("[warn] a tag, date or name in not found in '$line'.\n");
   
 
1413 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $time = sprintf('%04d/%02d/%02d %02d:%02d', $1, $2, $3, $4, $5);
  
 
1414 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $a    = $self->parse_standard_tag($6);
  
 
1415 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $name = $self->rewrite($7);
  
 
1416 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $link = $self->absolute_url($a->{'attr'}->{'href'}, $base);
  
 
1417 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		push(@items, {'time' => $time, 'name' => $name, 'link' => $link});
  
 
1418 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1419 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1420 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1421 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1422 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_show_log_count {
  
 
1423 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1424 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
1425 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1426 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
1427 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
1428 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $count   = ($content =~ /ページ全体のアクセス数:(\d+)<\/b> アクセス/) ? $1 : 0;
   
 
1429 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $count;
  
 
1430 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1431 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1432 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_view_album {
  
 
1433 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1434 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
1435 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1436 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
1437 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
1438 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
1439 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get album part
  
 
1440 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_from = qq(\Q\E);
  
 
1441 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_with = qq(\Q\E);
  
 
1442 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_till = qq(\Q\E);
  
 
1443 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] album part is missing.\n") unless ($content =~ /$content_from(.*?$content_with.*?)$content_till/s);
  
 
1444 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
1445 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse album part
  
 
1446 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $img    = ($content =~ /(
)/is) ? $1 : return $self->log("[warn] thumbnail is missing.\n");
 
 
 
1447 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$img = $self->parse_standard_tag($img);
  
 
1448 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$img = $img->{'attr'}->{'src'};
  
 
1449 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $name   = ($content =~ /(.*?)\Qさんのフォトアルバム\E<\/p>/is) ? $1 : return $self->log("[warn] name is missing.\n");
 
 
 
1450 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $subj   = ($content =~ / (.*?)<\/td>/is) ? $1 : return $self->log("[warn] title is missing.\n");
  
 
1451 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $desc   = ($content =~ /説明<\/th>\s* (.*?)<\/td>/s) ? $1 : return $self->log("[warn] description is missing.\n");
  
 
1452 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $level  = ($content =~ /公開レベル<\/th>\s* (.*?) 
 
1453 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $time   = ($content =~ /作成日時<\/th>\s* (\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2})<\/td>/s) ? sprintf('%04d/%02d/%02d %02d:%02d', $1, $2, $3, $4, $5) : return $self->log("[warn] time is missing.\n");
  
 
1454 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $comm   = ($content =~ / ]*class="view_etc">.*?コメント\((\d+)\)/is) ? $1 : return $self->log("[warn] comment is missing.\n");
  
 
1455 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $number = ($content =~ /.*?(\d+)枚/) ? $1 : return $self->log("[warn] number is missing.\n");
   
 
1456 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$name = $self->rewrite($name);
  
 
1457 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$subj = $self->rewrite($subj);
  
 
1458 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$desc = $self->rewrite($desc);
  
 
1459 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $item = { 'image' => $self->absolute_url($img, $base), 'name' => $name, 'subject' => $subj, 'description' => $desc, 'level' => $level, 'time' => $time, 'comment_number' => $comm, 'photo_number' => $number};
  
 
1460 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	push(@items, $item);
  
 
1461 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1462 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1463 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1464 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_view_album_comment {
  
 
1465 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1466 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
1467 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1468 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
1469 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
1470 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
1471 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get comment part
  
 
1472 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_from = "\Q\E";
  
 
1473 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_till = "\Q\E";
  
 
1474 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] Album comment part is missing.\n") unless ($content =~ /$content_from(.+?)$content_till/s);
  
 
1475 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
1476 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse comment items
  
 
1477 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @rows = ($content =~ /( .*?<\/tr>.*?)<\/tr>/gis);
 
  
1478 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] no item found in album comment part.\n") unless (@rows);
  
 
1479 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse comments
  
 
1480 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $str (@rows) {
  
 
1481 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my $time = ($str =~ / (\d{4})年(\d{2})月(\d{2})日  
1482 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my ($link, $name) = ($str =~ / ()(.*?)<\/a>/is) ? ($1, $2) : next;
   
 
1483 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$link    = $self->parse_standard_tag($link);
  
 
1484 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$link    = $link->{'attr'}->{'href'};
  
 
1485 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my $desc = ($content =~ / (.*?)<\/td>/is) ? $1 : next;
  
 
1486 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $item = {
  
 
1487 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			'time' => $time,
  
 
1488 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			'link' => $self->absolute_url($link, $base),
  
 
1489 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			'name' => $self->rewrite($name),
  
 
1490 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			'description' => $self->rewrite($desc)
  
 
1491 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		};
  
 
1492 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		push(@items, $item);
  
 
1493 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1494 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1495 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1496 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1497 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_view_album_photo {
  
 
1498 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1499 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
1500 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1501 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
1502 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
1503 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
1504 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get album photo part
  
 
1505 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_from = qq(\Q\E);
  
 
1506 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_till = qq(\Q\E);
  
 
1507 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] album photo part is missing.\n") unless ($content =~ /$content_from(.*?)$content_till/s);
  
 
1508 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
1509 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse album photo items
  
 
1510 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @rows = ($content =~ /(.*?)<\/p>/gs);
 
 
 
1511 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] no item found in album photo part.\n") unless (@rows);
  
 
1512 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse tool bar part
  
 
1513 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $str (@rows) {
  
 
1514 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my $anchor = ($str =~ /()/) ? $1 : next;
   
 
1515 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my $image  = ($str =~ /( 
 
1516 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my $subj   = ($str =~ /(.*?)<\/a>/) ? $1 : next;
  
 
 
1517 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		($anchor, $image) = map { $self->parse_standard_tag($_) } ($anchor, $image);
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1518 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $item = {
  
 
1519 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			'description' => $image->{'attr'}->{'alt'},
  
 
1520 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			'thumb_link' => $self->absolute_url($image->{'attr'}->{'src'}, $base),
  
 
1521 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			'link' => $self->absolute_url($anchor->{'attr'}->{'href'}, $base),
  
 
1522 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			'subject' => $self->rewrite($subj)
  
 
1523 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		};
  
 
1524 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		push(@items, $item);
  
 
1525 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1526 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1527 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1528 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1529 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_view_bbs {
  
 
1530 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1531 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
1532 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1533 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
1534 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
1535 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
1536 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get topic, comments part
  
 
1537 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $topic_from    = qq(\Q\E);
  
 
1538 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $topic_till    = qq(\Q\E);
  
 
1539 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $comments_from = qq(\Q\E);
 
1540 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $comments_till = qq(\Q\E);
 
1541 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $content_topic    = ($content =~ /${topic_from}(.*?)${topic_till}/s) ?       $1 : return $self->log("[warn] topic part is missing.\n");
  
 
1542 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $content_comments = ($content =~ /${comments_from}(.*?)${comments_till}/s) ? $1 : return $self->log("[warn] comments part is missing.\n");
  
 
1543 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# regex for parsing
  
 
1544 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_subj = ' ]*>(.*?)<\/b><\/td>';
   
 
1545 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_time = ' ]* nowrap>\s*(\d{4})年(\d{2})月(\d{2})日\s* 
 
1546 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_link = ' .*?(.*?)<\/a>';
   
 
1547 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_imgs = ' \s*(.*?<\/table>)?';
 
1548 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_desc = ' \s*(?:.*?<\/table>)?(.*?)<\/td>';
 
1549 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse topic
  
 
1550 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $subj = ($content_topic =~ /$re_subj/)  ? $1 : return $self->log("[warn] subject is not found.\n$content_topic");
  
 
1551 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $time = ($content_topic =~ /$re_time/)  ? sprintf('%04d/%02d/%02d %02d:%02d', $1,$2,$3,$4,$5) : return $self->log("[warn] time is not found.\n$content_topic");
  
 
1552 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $link = ($content_topic =~ /$re_link/)  ? $1 : return $self->log("[warn] link is not found.\n$content_topic");
  
 
1553 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $name = $2;
  
 
1554 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $imgs = ($content_topic =~ /$re_imgs/s) ? $1 : return $self->log("[warn] imgs are not found.\n$content_topic");
  
 
1555 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $desc = ($content_topic =~ /$re_desc/s) ? $1 : return $self->log("[warn] description is not found.\n$content_topic");
  
 
1556 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	($name, $desc) = map { s/[\r\n]+//g; s/ 
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1557 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $item = { 'time' => $time, 'description' => $desc, 'subject' => $subj, 'link' => $res->request->uri->as_string, 'images' => [], 'comments' => [] , 'name' => $name, 'name_link' => $self->absolute_url($link, $base)};
  
 
1558 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @images = ($imgs =~ /]*>.*?<\/a>/gs);
   
 
1559 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $image (@images) {
  
 
1560 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		# parse images
  
 
1561 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		next unless ($image =~ /]*'show_picture.pl\?img_src=(.*?)'[^<>]*>  
 
1562 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		push(@{$item->{'images'}}, {'link' => $self->absolute_url($1, $base), 'thumb_link' => $self->absolute_url($2, $base)});
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1563 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1564 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse comments
  
 
1565 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @comments = ($content_comments =~ /  (.*?)\n<\/table>\n<\/td>\n<\/tr>/gs);
 
 
1566 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $comment (@comments) {
  
 
1567 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		unless ($comment =~ /$re_time/) { $self->log("[warn] time is not found in comment.\n$comment"); next; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1568 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $time = sprintf('%04d/%02d/%02d %02d:%02d', $1,$2,$3,$4,$5);
  
 
1569 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		unless ($comment =~ /$re_link/s) { $self->log("[warn] link is not found in comment.\n$comment"); next; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1570 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $link = $1;
  
 
1571 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $name = $2;
  
 
1572 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		unless ($comment =~ /$re_imgs/s) { $self->log("[warn] imgs are not found in comment.\n$comment"); next; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1573 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $imgs = $1;
  
 
1574 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		unless ($comment =~ /$re_desc/s) { $self->log("[warn] desc is not found in comment.\n$comment"); next; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1575 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $desc = $1;
  
 
1576 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		($name, $desc) = map { s/[\r\n]+//g; s/ 
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1577 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $comment = {'time' => $time, 'link' => $self->absolute_url($link, $base), 'name' => $name, 'description' => $desc, 'images' => []};
  
 
1578 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @images = ($imgs =~ /]*>.*?<\/a>/g);
   
 
1579 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		foreach my $image (@images) {
  
 
1580 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			# parse images
  
 
1581 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			next unless ($image =~ /]*'show_picture.pl\?img_src=(.*?)'[^<>]*>  
 
1582 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			push(@{$comment->{'images'}}, {'link' => $self->absolute_url($1, $base), 'thumb_link' => $self->absolute_url($2, $base)});
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1583 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
1584 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		push(@{$item->{'comments'}}, $comment);
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1585 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1586 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	push(@items, $item);
  
 
1587 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1588 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1589 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1590 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_view_diary {
  
 
1591 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1592 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
1593 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1594 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
1595 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
1596 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $item    = undef;
  
 
1597 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_date = qr/(\d{4})年(\d{1,2})月(\d{1,2})日.*?(\d{1,2}):(\d{1,2})/is;
  
 
1598 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# diary
  
 
1599 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $diary_from = qq(\Q\E);
 
1600 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $diary_till = qq(\Q 
 
1601 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] diary part is missing.\n") unless ($content =~ /$diary_from(.*?)$diary_till/s);
  
 
1602 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $diary_part = $1;
  
 
1603 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	{
  
 
1604 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		# get and parse diary title part
  
 
1605 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $re_part = qr/  (.*?)<\/tr>/is;
 
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1606 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $re_cols = qr/ ]*>(.*?)<\/td>\s* ]*>(.*?)<\/td>/is;
  
 
1607 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my ($level_part, $subj_part) = ($diary_part =~ /^(.*)$re_part/is) ? ($1, $2) : return $self->log("[warn] subj part is not found in content.\n$diary_part");
  
 
1608 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my ($time, $subj) = ($subj_part =~ $re_cols) ? ($1, $2) : return $self->log("[warn] time and/or subj are not found in subj part.\n$subj_part");
  
 
1609 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$time = ($time =~ $re_date) ? sprintf('%04d/%02d/%02d %02d:%02d', $1, $2, $3, $4, $5) : $self->log("[warn] time is not matches regex.\n$time");
  
 
1610 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$subj =~ s/^ //;
  
 
1611 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$subj = $self->rewrite($subj);
  
 
1612 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $level = undef;
  
 
1613 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my $raw_img = ($level_part =~ /( 
 
1614 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $img = $self->parse_standard_tag($raw_img);
  
 
1615 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$level = { 'description' => $self->rewrite($img->{'attr'}->{'alt'}), 'link' => $self->absolute_url($img->{'attr'}->{'src'}, $base), 'raw' => $raw_img };
  
 
1616 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$item  = { 'subject' => $subj, 'link' => $res->request->uri->as_string, 'time' => $time, 'level' => $level };
  
 
1617 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1618 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse diary description part
  
 
1619 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	{
  
 
1620 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $re_part = "\E\n";
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1621 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $re_desc = " (.+?)<\/td>"; 
  
 
1622 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $re_imgs = "\E.*?";
  
 
1623 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my $desc_part = ($content =~ /$re_part/is) ? $1 : return $self->log("[warn] description is not found in content.\n$content");
  
 
1624 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my ($raw_imgs, $raw_desc) = ($desc_part =~ /(?:$re_imgs)?$re_desc/is) ? ($1, $2) : return $self->log("[warn] desc is not found in desc part.\n$desc_part");
  
 
1625 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $desc = $raw_desc;
  
 
1626 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$desc =~ s/[\r\n]+//g;
  
 
1627 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$desc =~ s/ 
 
1628 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		while ($desc =~ /( 
 
1629 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $tag = $1;
  
 
1630 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $img = $self->parse_standard_tag($1);
  
 
1631 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$img = ($img) ? "[画像] " . $self->absolute_url($img->{'attr'}->{'src'}, $base) . " " : "";
  
 
1632 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$desc =~ s/\Q$tag\E/\Q$img\E/g;
  
 
1633 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
1634 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$item->{'raw_description'} = $raw_desc;
  
 
1635 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$item->{'description'} = $self->rewrite($desc);
  
 
1636 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$item->{'images'} = [];
  
 
1637 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		foreach my $image ($raw_imgs =~ / ]*>(.*?)<\/td>/g) {
  
 
1638 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			next unless ($image =~ /]*'(show_diary_picture.pl\?.*?)'[^<>]*>  
 
1639 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			push(@{$item->{'images'}}, {'link' => $self->absolute_url($1, $base), 'thumb_link' => $self->absolute_url($2, $base)});
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1640 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
1641 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1642 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get and parse diary comment part
  
 
1643 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $comment_from = qq(\Q 
 
1644 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $comment_till = qq(\Q 
 
1645 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] comment part is missing.\n") unless ($content =~ /$comment_from(.*?)$comment_till/s);
  
 
1646 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $comment_part = $1;
  
 
1647 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$item->{'comments'} = [];
  
 
1648 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	{
  
 
1649 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $comm_from = qq(\Q \E);
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1650 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $desc_from = "\Q \E[\r\n]?";
  
 
1651 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $desc_till = "\Q \E";
 
 
1652 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		foreach my $comment ($comment_part =~ /$comm_from(.*?${desc_from}.*?${desc_till})/gis) {
  
 
1653 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			my ($header, $raw_desc) = ($comment =~ /^(.*)${desc_from}(.*?)${desc_till}/gis) ? ($1, $2) : return $self->log("[warn] description is not found in comment.\n$comment");
  
 
1654 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $desc = $raw_desc;
  
 
1655 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$desc =~ s/[\r\n]+//g;
  
 
1656 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$desc =~ s/ 
 
1657 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			my $time = ($header =~ $re_date) ? sprintf('%04d/%02d/%02d %02d:%02d', $1, $2, $3, $4) : return $self->log("[warn] time is not found in comment header.\n$header");
  
 
1658 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			my ($link, $name) = ($header =~ /(.*)<\/a>/) ? ($1, $2) : return $self->log("[warn] name and link are not found in comment header.\n$header");
   
 
1659 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			push(@{$item->{'comments'}}, {
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1660 
 
 
 
 
 
 
 
 
 
 
 
 
 
 				'time' => $time, 'link' => $self->absolute_url($link, $base), 'name' => $self->rewrite($name),
  
 
1661 
 
 
 
 
 
 
 
 
 
 
 
 
 
 				'description' => $self->rewrite($desc), 'raw_description' => $raw_desc
  
 
1662 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			});
  
 
1663 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
1664 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1665 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return ($item);
  
 
1666 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1667 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1668 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_view_event {
  
 
1669 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
1670 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my ($res, $content, $url, $base) = $self->parse_parser_params(@_);
  
 
1671 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1672 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
1673 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get event, pages, comments part
  
 
1674 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $event_from       = "\Q\E";
  
 
1675 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $content_event    = ($content =~ /$event_from(.*?)\Q\E/s)                   ? $1 : return $self->log("[warn] event part is missing.\n");
  
 
1676 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $content_pages    = ($content =~ /\Q\E(.*?)\Q\E/s) ? $1 : '';
  
 
1677 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $content_comments = ($content =~ /\Q\E(.*?)\Q\E/s)     ? $1 : '';
  
 
1678 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# make regex for table parsing
  
 
1679 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $attr = qr/\s+(?:"[^""]*"|'[^'']*'|[^<>]+)?/;
  
 
1680 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my ($table, $tr, $td) = (qr/table(?:$attr)*/, qr/tr(?:$attr)*/, qr/td(?:$attr)*/);
  
 
1681 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $char = qr/(?!<\/?(?:table|th|tr|td)(?:$attr)*>)[\s\S]/;
  
 
1682 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $str  = qr/(?:$char)*/;
  
 
1683 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $s    = qr/(?:\s+|\Q \E)*/;
  
 
1684 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse event
  
 
1685 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $item   = {};
  
 
1686 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $time   = sprintf('%04d/%02d/%02d %02d:%02d', $2, $3, $4, $5, $6) if ($content_event =~ /(<$td>$s(\d{4})年(\d{2})月(\d{2})日$str(\d{1,2}):(\d{2})$s<\/$td>)/is);
  
 
1687 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my @images = ($1, $2, $3) if ($content_event =~ /$1$s<$td>$s<$table>$s<$tr>$s<$td>($str)<\/$td>(?:$s<$td>($str)<\/$td>(?:$s<$td>($str)<\/$td>)?)?$s<\/$tr>$s<\/$table>$s<\/$td>$s<\/$tr>/is);
  
 
1688 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $subj   = $1 if ($content_event =~ /<$td>$s\Qタイトル\E$s<\/$td>$s<$td>$s($str)<\/$td>/is);
  
 
1689 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] Can't parse event time.\n")  unless(defined($time));
  
 
1690 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] Can't parse event title.\n") unless(defined($subj));
  
 
1691 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $name   = $1 if ($content_event =~ /<$td>$s\Q企画者\E$s<\/$td>$s<$td>$s($str)<\/$td>/is);
  
 
1692 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $date   = $1 if ($content_event =~ /<$td>$s\Q開催日時\E$s<\/$td>$s<$td>$s($str)<\/$td>/is);
  
 
1693 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $loca   = $1 if ($content_event =~ /<$td>$s\Q開催場所\E$s<\/$td>$s<$td>$s($str)<\/$td>/is);
  
 
1694 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $comm   = $1 if ($content_event =~ /<$td>$s\Q関連コミュニティ\E$s<\/$td>$s<$td>$s($str)<\/$td>/is);
  
 
1695 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $desc   = $1 if ($content_event =~ /<$td>$s\Q詳細\E$s<\/$td>$s<$td><$table>$s<$tr>$s<$td>($str)<\/$td>$s<\/$tr>$s<\/$table>$s<\/$td>/is);
  
 
1696 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $limit  = $1 if ($content_event =~ /<$td>$s\Q募集期限\E$s<\/$td>$s<$td>$s($str)<\/$td>/is);
  
 
1697 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my ($count, $list) = ($1, $2) if ($content_event =~ /<$td>$s\Q参加者\E$s<\/$td>$s<$td>$s<$table>$s<$tr>$s<$td>$s($str)<\/$td>$s<$td>$s($str)<\/$td>/is);
  
 
1698 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $join  = $1 if ($content_event =~ / 
 
1699 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$join = ($join eq ' イベントに参加する ') ? 1 : ($join eq " 参加をキャンセルする ") ? 2 : 0;
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
1700 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	($comm, my $comm_link) = ($comm =~ / ]*)["'](?:$attr)*>(.*?)<\/a>/is) ? ($2, $self->absolute_url($1, $base)) : (undef, undef);
   
 
1701 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	($list, my $list_link) = ($list =~ / ]*)["'](?:$attr)*>(.*?)<\/a>/is) ? ($2, $self->absolute_url($1, $base)) : (undef, undef);
   
 
1702 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	($name, my $name_link) = ($name =~ / ]*)["'](?:$attr)*>(.*?)<\/a>/is) ? ($2, $self->absolute_url($1, $base)) : (undef, undef);
   
 
1703 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	($subj, $desc, $date, $loca) = map { s/[\r\n]+//g; s/ 
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1704 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$item = {
  
 
1705 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'time'   => $time, 'description' => $desc, 'subject'  => $subj,  'link' => $url, 'name' => $name, 'name_link' => $name_link,
  
 
1706 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'date'   => $date, 'location'    => $loca, 'deadline' => $limit, 'join' => $join,
  
 
1707 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'images' => [],    'comments'    => [],    'pages'    => [],
  
 
1708 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'list'      => { 'subject' => $list, 'link' => $list_link, 'count' => $count },
  
 
1709 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'community' => { 'name'    => $comm, 'link' => $comm_link },
  
 
1710 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	};
  
 
1711 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $image (@images) {
  
 
1712 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 		next unless ($image and $image =~ /$s  
 
1713 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		push(@{$item->{'images'}}, {'link' => $self->absolute_url($1, $base), 'thumb_link' => $self->absolute_url($2, $base)});
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1714 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1715 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse pages
  
 
1716 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	if ($content_pages and $content_pages =~ /(.*\Q全てを表示\E.*)\Q  [\E(.*?)\Q]  \E(.*\Q最新の10件を表示\E.*)/) {
  
 
1717 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @pages = ($1, $2, $3);
  
 
1718 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		splice(@pages, 1, 1, ($pages[1] =~ /(.*?<\/a>|\d+)/gi));
   
 
1719 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		foreach my $page (@pages) {
  
 
1720 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			if ($page =~ /]*)["']?(?:$attr)*>(.*?)<\/a>/) {
   
 
1721 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				push(@{$item->{'pages'}}, { 'current' => 0, 'link' => $self->absolute_url($1, $base), 'subject' => $2});
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1722 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			} else {
  
 
1723 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				push(@{$item->{'pages'}}, { 'current' => 1, 'link' => $url, 'subject' => $page});
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1724 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
1725 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
1726 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1727 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse comments
  
 
1728 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($content_comments) {
  
 
1729 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @comments = split(/ /i, $content_comments);
  
 
1730 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		foreach my $comment (@comments) {
  
 
1731 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			next unless ($comment =~ /
  
 
1732 
 
 
 
 
 
 
 
 
 
 
 
 
 
 				^$s(\d{4})年(\d{2})月(\d{2})日$str(\d{1,2}):(\d{2})$str<\/$td>$s
  
 
1733 
 
 
 
 
 
 
 
 
 
 
 
 
 
 				<$td>$str$s(\d+)$s<\/b>$s:($str)<\/$td>$s<\/$tr>
   
 
1734 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			/isx);
  
 
1735 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $time = sprintf('%04d/%02d/%02d %02d:%02d', $1, $2, $3, $4, $5);
  
 
1736 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my ($subj, $name) = ($6, $7);
  
 
1737 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			my @images = ($1, $2, $3) if ($comment =~ s/<$table>$s<$tr>$s<$td>($str 
 
1738 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			my $desc = $self->rewrite($1) if ($comment =~ /<$tr>$s<$td>$s<$table>$s<$tr>$s<$td>($str)<\/$td>$s<\/$tr>$s<\/$table>$s<\/$td>$s<\/$tr>/is);
  
 
1739 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 			@images = grep { $_ } map {
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1740 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				($_ and /$s  
 
1741 
 
 
 
 
 
 
 
 
 
 
 
 
 
 				? {'link' => $self->absolute_url($1, $base), 'thumb_link' => $self->absolute_url($2, $base)} : undef
  
 
1742 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			} @images;
  
 
1743 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			($name, my $link) = ($name =~ / ]*)["'](?:$attr)*>(.*?)<\/a>/is) ? ($2, $self->absolute_url($1, $base)) : (undef, undef);
   
 
1744 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			push(@{$item->{'comments'}}, {'subject' => $subj, 'name' => $name, 'link' => $link, 'time' => $time, 'description' => $desc, 'images' => [@images]});
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1745 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
1746 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1747 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	push(@items, $item);
  
 
1748 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1749 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1750 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1751 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_view_message {
  
 
1752 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self      = shift;
  
 
1753 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res       = (@_) ? shift : $self->response();
  
 
1754 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1755 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base      = $res->request->uri->as_string;
  
 
1756 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content   = $res->content;
  
 
1757 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# make regex for table parsing
  
 
1758 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $attr = qr/\s+(?:"[^""]*"|'[^'']*'|[^<>]+)?/;
  
 
1759 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my ($table, $tr, $td) = (qr/table(?:$attr)*/, qr/tr(?:$attr)*/, qr/td(?:$attr)*/);
  
 
1760 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $char = qr/(?!<\/?(?:table|th|tr|td)(?:$attr)*>)[\s\S]/;
  
 
1761 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $str  = qr/(?:$char)*/;
  
 
1762 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $s    = qr/(?:\s+|\Q \E)*/;
  
 
1763 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get request list part
  
 
1764 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_from = "\Qメッセージの詳細 \E";
  
 
1765 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_till = "<[^<>]*\Qhttp://img.mixi.jp/img/q_brown3.gif\E[^<>]*>";
  
 
1766 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] Detail part is missing.\n") unless ($content =~ /$content_from(.+?)$content_till/s);
  
 
1767 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
1768 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse message
  
 
1769 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $item  = {};
  
 
1770 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $label_time = "(?:\Q日 付\E|\Q日 付\E)";
  
 
1771 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $label_name = "(?:\Q差出人\E|\Q宛 先\E)";
  
 
1772 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $label_subj = "(?:\Q件 名\E|\Q件 名\E)";
  
 
1773 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $time  = sprintf('%04d/%02d/%02d %02d:%02d', $1, $2, $3, $4, $5) if ($content =~ /<$td>$s$label_time<\/font>$s:$s(\d{4})年(\d{2})月(\d{2})日$s(\d{2})時(\d{2})分$s$s<\/td>/is);
   
 
1774 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $subj  = $self->rewrite($1) if ($content =~ /<$td>$s$label_subj<\/font>$s:$s($str)<\/td>/is);
   
 
1775 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $desc  = $self->rewrite($1) if ($content =~ / $s($str)<\/td>/is);
  
 
1776 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $image = $self->absolute_url($1, $base) if ($content =~ /<$td> 
 
1777 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $name  = $1 if ($content =~ /<$td>$s$label_name<\/font>$s:$s($str)<\/td>/is);
   
 
1778 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	($name, my $link) = ($name =~ / ]*)["'](?:$attr)*>(.*?)(?:<\/a>)?$/is) ? ($self->rewrite($2), $self->absolute_url($1, $base)) : ($self->rewrite($name), undef);
   
 
1779 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$item = { 'subject' => $subj, 'time' => $time, 'name' => $name, 'link' => $link, 'image' => $image, 'description' => $desc };
  
 
1780 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $item;
  
 
1781 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1782 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1783 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_view_message_form {
  
 
1784 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self      = shift;
  
 
1785 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res       = (@_) ? shift : $self->response();
  
 
1786 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1787 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base      = $res->request->uri->as_string;
  
 
1788 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content   = $res->content;
  
 
1789 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items     = ();
  
 
1790 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	while ($content =~ s/ 
 
1791 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $action = $1;
  
 
1792 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $submit = $2;
  
 
1793 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$submit = ($submit =~ / 
 
1794 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my $command = $1 if ($action =~ /([^\/\?]+)\.pl(\?[^\/]*)?$/);
  
 
1795 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $item = {
  
 
1796 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			'action' => $self->absolute_url($action),
  
 
1797 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			'submit' => $submit,
  
 
1798 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			'command' => $command,
  
 
1799 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		};
  
 
1800 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		push(@items, $item);
  
 
1801 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1802 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1803 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1804 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1805 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_add_diary_preview {
  
 
1806 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1807 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my @items   = grep { $_ and $_->{'__action__'} =~ /\Qadd_diary.pl\E/ } $self->parse_standard_form();
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1808 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1809 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1810 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1811 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_add_diary_confirm {
  
 
1812 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self      = shift;
  
 
1813 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res       = (@_) ? shift : $self->response();
  
 
1814 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1815 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base      = $res->base->as_string;
  
 
1816 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content   = $res->content;
  
 
1817 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items     = ();
  
 
1818 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $succeed   = '作成が完了しました。';
  
 
1819 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($content =~ /(.*?)<\/form>/s) {
 
1820 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$content = $1;
  
 
1821 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if (index($content, $succeed) != -1) {
  
 
1822 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			my $link = ($content =~ / 
 
1823 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $subj = $self->rewrite($content);
  
 
1824 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$subj =~ s/[\r\n]+//g;
  
 
1825 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			push(@items, {'subject' => $subj, 'result' => 1, 'link' => $link });
  
 
1826 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
1827 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1828 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1829 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1830 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1831 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_delete_diary_preview {
  
 
1832 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1833 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my @items   = grep { $_ and $_->{'__action__'} =~ /\Q_diary.pl\E/ } $self->parse_standard_form();
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1834 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1835 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1836 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1837 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_delete_diary_confirm {
  
 
1838 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1839 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_diary(@_);
  
 
1840 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1841 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1842 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_edit_diary_preview {
  
 
1843 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1844 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my @items   = grep { $_ and $_->{'__action__'} =~ /\Q_diary.pl\E/ } $self->parse_standard_form();
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1845 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1846 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1847 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1848 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_edit_diary_image {
  
 
1849 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1850 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
1851 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
1852 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1853 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
1854 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
1855 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $photo ($content =~ / .*?<\/tr>/gs) {
  
 
1856 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my $subj = ($photo =~ /(.*?)<\/td>/) ? $1 : next;
   
 
1857 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my ($thumb, $link) = ($photo =~ /削除<\/a>/) ? ($1, $2) : next;
   
 
1858 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $item = {
  
 
1859 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			'subject' => $self->rewrite($subj),
  
 
1860 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			'link' => $self->absolute_url($link, $base),
  
 
1861 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			'thumb_link' => $self->absolute_url($thumb, $base),
  
 
1862 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		};
  
 
1863 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		push(@items, $item);
  
 
1864 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1865 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1866 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1867 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1868 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_edit_diary_confirm {
  
 
1869 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1870 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_diary(@_);
  
 
1871 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1872 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1873 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_send_message_preview {
  
 
1874 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1875 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my @items   = grep { $_ and $_->{'__action__'} =~ /\Qsend_message.pl\E/ } $self->parse_standard_form();
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
1876 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1877 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1878 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1879 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_send_message_confirm {
  
 
1880 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self      = shift;
  
 
1881 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res       = (@_) ? shift : $self->response();
  
 
1882 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1883 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base      = $res->base->as_string;
  
 
1884 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content   = $res->content;
  
 
1885 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items     = ();
  
 
1886 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $succeed   = '送信完了 しました。';
  
 
1887 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($content =~ /  [^\n]*? 
1888 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$content = $1;
  
 
1889 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if (index($content, $succeed) != -1) {
  
 
1890 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $item = { 'subject' => $self->rewrite($succeed), 'result' => 1 };
  
 
1891 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			if ($content =~ / 
 
1892 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$item->{'banner'} = {
  
 
1893 
 
 
 
 
 
 
 
 
 
 
 
 
 
 					'link'    => $self->absolute_url($1, $base),
  
 
1894 
 
 
 
 
 
 
 
 
 
 
 
 
 
 					'image'   => $self->absolute_url($2, $base),
  
 
1895 
 
 
 
 
 
 
 
 
 
 
 
 
 
 					'subject' => $self->rewrite($3),
  
 
1896 
 
 
 
 
 
 
 
 
 
 
 
 
 
 				};
  
 
1897 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
1898 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			push(@items, $item)
  
 
1899 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
1900 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1901 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1902 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1903 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1904 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_news_category {
  
 
1905 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1906 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
1907 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1908 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
1909 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
1910 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
1911 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1912 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($content =~ / 
 
1913 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		while ($content =~ s/1914 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $item = {};
  
 
1915 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$item->{'link'}     = $self->absolute_url($1, $base);
  
 
1916 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$item->{'subject'}  = $self->rewrite($3);
  
 
1917 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$item->{'category'} = $self->rewrite($1);
  
 
1918 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$item->{'category'} = $2 if ($item->{'category'} =~ /\?(id|type)=([A-Za-z0-9]+)/);
  
 
1919 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			push(@items, $item);
  
 
1920 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
1921 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1922 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1923 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1924 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1925 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1926 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_news {
  
 
1927 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1928 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
1929 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1930 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
1931 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
1932 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
1933 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1934 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($content =~ /(.+?)<\/table>/s) {
 
1935 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$content = $1;
  
 
1936 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$content =~ s/\x0D\x0A//g;
  
 
1937 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$content =~ s/\x0D//g;
  
 
1938 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$content =~ s/\x0A//g;
  
 
1939 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1940 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		while ($content =~ s/ (.*?)<\/A>(.*?)<\/td> (.*?)<\/A><\/td> (.*?)<\/td><\/tr>//is) {
  
 
1941 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $item = {};
  
 
1942 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1943 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$item->{'link'}        = $self->absolute_url($1, $base);
  
 
1944 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$item->{'subject'}     = $self->rewrite($2);
  
 
1945 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$item->{'media_code'}  = $self->absolute_url($4, $base);
  
 
1946 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$item->{'media_title'} = $self->rewrite($5);
  
 
1947 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$item->{'time'}        = $self->rewrite($6);
  
 
1948 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$item->{'time'}        = $self->rewrite(sprintf('%02d/%02d %02d:%02d', $1, $2, $3, $4)) if ($item->{'time'} =~ /(\d{2})月(\d{2})日 (\d{2}):(\d{2})/s);
  
 
1949 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1950 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $image = $3;
  
 
1951 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			while ($image =~ s/ 
 
1952 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				my $imageurl = $1;
  
 
1953 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 				if ($imageurl =~ /news_new/) {
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
1954 
 
0
 
 
 
 
 
 
 
 
 
 
 
 					$item->{'new_image'} = $self->rewrite($imageurl);
  
 
1955 
 
 
 
 
 
 
 
 
 
 
 
 
 
 				} elsif ($imageurl =~ /news_camera/) {
  
 
1956 
 
0
 
 
 
 
 
 
 
 
 
 
 
 					$item->{'camera_image'} = $self->rewrite($imageurl);
  
 
1957 
 
 
 
 
 
 
 
 
 
 
 
 
 
 				}
  
 
1958 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
1959 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			push(@items, $item);
  
 
1960 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
1961 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
1962 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
1963 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1964 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1965 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1966 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_news_next {
  
 
1967 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1968 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
1969 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1970 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
1971 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
1972 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($content =~ / .*?]*?list_news_category.pl[^<>]*?)>([^<>]*?)<\/a><\/td>/);
   
 
1973 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $subject = $2;
  
 
1974 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $link    = $self->absolute_url($1, $base);
  
 
1975 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $next    = {'link' => $link, 'subject' => $2};
  
 
1976 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $next;
  
 
1977 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1978 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1979 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_news_previous {
  
 
1980 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1981 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
1982 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1983 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
1984 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
1985 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($content =~ / ]*?list_news_category.pl[^<>]*?)>([^<>]*?)<\/a>/);
   
1986 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $subject = $2;
  
 
1987 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $link    = $self->absolute_url($1, $base);
  
 
1988 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $next    = {'link' => $link, 'subject' => $2};
  
 
1989 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $next;
  
 
1990 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
1991 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1992 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
1993 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_list_news_ranking {
  
 
1994 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
1995 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
1996 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
1997 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
1998 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
1999 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
2000 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2001 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($content =~ /(.+?)<\/table>/s) {
 
2002 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$content = $1;
  
 
2003 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$content =~ s/\x0D\x0A//g;
  
 
2004 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$content =~ s/\x0D//g;
  
 
2005 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$content =~ s/\x0A//g;
  
 
2006 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2007 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		while ($content =~ s/ (.*?)<\/td> (.*?)<\/A>(.*?)<\/td> (.*?)<\/A><\/td> (.*?)<\/td><\/tr>//is) {
  
 
2008 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $item = {};
  
 
2009 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2010 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$item->{'count'}       = $self->rewrite($1);
  
 
2011 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$item->{'link'}        = $self->absolute_url($2, $base);
  
 
2012 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$item->{'subject'}     = $self->rewrite($3);
  
 
2013 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$item->{'media_code'}  = $self->absolute_url($5, $base);
  
 
2014 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$item->{'media_title'} = $self->rewrite($6);
  
 
2015 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$item->{'time'}        = $self->rewrite($7);
  
 
2016 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$item->{'time'}        = $self->rewrite(sprintf('%02d/%02d %02d:%02d', $1, $2, $3, $4)) if ($item->{'time'} =~ /(\d{2})月(\d{2})日 (\d{2}):(\d{2})/s);
  
 
2017 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			push(@items, $item);
  
 
2018 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
2019 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2020 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
2021 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2022 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2023 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2024 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2025 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2026 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2027 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2028 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2029 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2030 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2031 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_main_menu {
  
 
2032 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2033 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $url  = (@_) ? shift : undef;
  
 
2034 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($url) {
  
 
2035 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$self->set_response($url, @_) or return;
  
 
2036 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} else {
  
 
2037 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		return unless ($self->response);
  
 
2038 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		return unless ($self->response->is_success);
  
 
2039 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2040 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_main_menu();
  
 
2041 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2042 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2043 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_banner {
  
 
2044 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2045 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $url  = (@_) ? shift : undef;
  
 
2046 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($url) {
  
 
2047 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$self->set_response($url, @_) or return;
  
 
2048 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} else {
  
 
2049 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		return unless ($self->response);
  
 
2050 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		return unless ($self->response->is_success);
  
 
2051 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2052 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_banner();
  
 
2053 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2054 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2055 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_tool_bar {
  
 
2056 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2057 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $url  = (@_) ? shift : undef;
  
 
2058 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($url) {
  
 
2059 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$self->set_response($url, @_) or return;
  
 
2060 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} else {
  
 
2061 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		return unless ($self->response);
  
 
2062 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		return unless ($self->response->is_success);
  
 
2063 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2064 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_tool_bar();
  
 
2065 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2066 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2067 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 sub get_information           { my $self = shift; return $self->get_standard_data('parse_information',           'home.pl', @_); }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2068 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 sub get_home_new_album        { my $self = shift; return $self->get_standard_data('parse_home_new_album',        'home.pl', @_); }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2069 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 sub get_home_new_bbs          { my $self = shift; return $self->get_standard_data('parse_home_new_bbs',          'home.pl', @_); }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2070 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 sub get_home_new_comment      { my $self = shift; return $self->get_standard_data('parse_home_new_comment',      'home.pl', @_); }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2071 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 sub get_home_new_friend_diary { my $self = shift; return $self->get_standard_data('parse_home_new_friend_diary', 'home.pl', @_); }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2072 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 sub get_home_new_review       { my $self = shift; return $self->get_standard_data('parse_home_new_review',       'home.pl', @_); }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2073 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2074 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_ajax_new_diary {
  
 
2075 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2076 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url     = 'ajax_new_diary.pl';
  
 
2077 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url        = shift if (@_ and $_[0] ne 'refresh' and $_[0] ne 'friend_id');
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2078 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	my $refresh = shift if (@_ and $_[0] eq 'refresh');
  
 
2079 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %param   = @_;
  
 
2080 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	if (defined($param{'friend_id'}) and length($param{'friend_id'}) and $url !~ /[\?\&]friend_id=/) {
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2081 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$url .= ($url =~ /\?/) ? "&friend_id=$param{'friend_id'}" : "?friend_id=$param{'friend_id'}";
  
 
2082 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2083 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->get_standard_data('parse_ajax_new_diary', qr/ajax_new_diary\.pl/, $url, $refresh);
  
 
2084 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2085 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2086 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_community_id {
  
 
2087 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2088 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->get_standard_data('parse_community_id', qr/view_community\.pl/, @_);
  
 
2089 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2090 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2091 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_edit_member {
  
 
2092 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
2093 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url     = 'edit_member.pl';
  
 
2094 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url        = shift if (@_ and $_[0] ne 'refresh' and $_[0] ne 'id');
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2095 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	my $refresh = shift if (@_ and $_[0] eq 'refresh');
  
 
2096 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %param   = @_;
  
 
2097 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($url !~ /[\?\&]id=/) {
  
 
2098 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 		$url .= ($url =~ /\?/) ? "&id=$param{'id'}"     : "?id=$param{'id'}"   if (defined($param{'id'})   and length($param{'id'}));
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
2099 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 		$url .= ($url =~ /\?/) ? "&page=$param{'page'}" : "?id=$param{'page'}" if (defined($param{'page'}) and length($param{'page'}));
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
2100 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2101 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->get_standard_data('parse_edit_member', qr/edit_member\.pl/, $url, $refresh);
  
 
2102 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2103 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2104 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_edit_member_pages {
  
 
2105 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
2106 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url     = 'edit_member.pl';
  
 
2107 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url        = shift if (@_ and $_[0] ne 'refresh' and $_[0] ne 'id');
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2108 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	my $refresh = shift if (@_ and $_[0] eq 'refresh');
  
 
2109 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %param   = @_;
  
 
2110 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($url !~ /[\?\&]id=/) {
  
 
2111 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 		$url .= ($url =~ /\?/) ? "&id=$param{'id'}"     : "?id=$param{'id'}"   if (defined($param{'id'})   and length($param{'id'}));
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
2112 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 		$url .= ($url =~ /\?/) ? "&page=$param{'page'}" : "?id=$param{'page'}" if (defined($param{'page'}) and length($param{'page'}));
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
2113 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2114 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->get_standard_data('parse_edit_member_pages', qr/edit_member\.pl/, $url, $refresh);
  
 
2115 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2116 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2117 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_bbs {
  
 
2118 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
2119 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url     = 'list_bbs.pl';
  
 
2120 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url        = shift if (@_ and $_[0] ne 'refresh' and $_[0] ne 'id');
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2121 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	my $refresh = shift if (@_ and $_[0] eq 'refresh');
  
 
2122 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %param   = @_;
  
 
2123 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	if (defined($param{'id'}) and length($param{'id'}) and $url !~ /[\?\&]id=/) {
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2124 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$url .= ($url =~ /\?/) ? "&id=$param{'id'}" : "?id=$param{'id'}";
  
 
2125 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2126 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->get_standard_data('parse_list_bbs', qr/list_bbs\.pl/, $url, $refresh);
  
 
2127 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2128 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2129 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_bbs_next {
  
 
2130 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
2131 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url     = 'list_bbs.pl';
  
 
2132 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url        = shift if (@_ and $_[0] ne 'refresh' and $_[0] ne 'id');
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2133 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	my $refresh = shift if (@_ and $_[0] eq 'refresh');
  
 
2134 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %param   = @_;
  
 
2135 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	if (defined($param{'id'}) and length($param{'id'}) and $url !~ /[\?\&]id=/) {
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2136 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$url .= ($url =~ /\?/) ? "&id=$param{'id'}" : "?id=$param{'id'}";
  
 
2137 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2138 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, $refresh) or return;
  
 
2139 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_bbs_next();
  
 
2140 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2141 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2142 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_bbs_previous {
  
 
2143 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
2144 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url     = 'list_bbs.pl';
  
 
2145 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url        = shift if (@_ and $_[0] ne 'refresh' and $_[0] ne 'id');
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2146 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	my $refresh = shift if (@_ and $_[0] eq 'refresh');
  
 
2147 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %param   = @_;
  
 
2148 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	if (defined($param{'id'}) and length($param{'id'}) and $url !~ /[\?\&]id=/) {
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2149 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$url .= ($url =~ /\?/) ? "&id=$param{'id'}" : "?id=$param{'id'}";
  
 
2150 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2151 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, $refresh) or return;
  
 
2152 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_bbs_previous();
  
 
2153 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2154 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2155 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_bookmark {
  
 
2156 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2157 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'list_bookmark.pl';
  
 
2158 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2159 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2160 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_bookmark();
  
 
2161 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2162 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2163 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_comment {
  
 
2164 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2165 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'list_comment.pl';
  
 
2166 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2167 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2168 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_comment();
  
 
2169 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2170 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2171 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_community {
  
 
2172 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2173 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'list_community.pl';
  
 
2174 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2175 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2176 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_community();
  
 
2177 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2178 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2179 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_community_next {
  
 
2180 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2181 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'list_community.pl';
  
 
2182 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2183 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2184 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_community_next();
  
 
2185 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2186 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2187 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_community_previous {
  
 
2188 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2189 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'list_community.pl';
  
 
2190 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2191 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2192 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_community_previous();
  
 
2193 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2194 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2195 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_diary {
  
 
2196 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2197 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'list_diary.pl';
  
 
2198 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2199 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2200 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_diary();
  
 
2201 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2202 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2203 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_diary_capacity {
  
 
2204 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2205 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'list_diary.pl';
  
 
2206 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2207 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2208 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_diary_capacity();
  
 
2209 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2210 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2211 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_diary_next {
  
 
2212 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2213 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'list_diary.pl';
  
 
2214 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2215 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2216 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_diary_next();
  
 
2217 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2218 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2219 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_diary_previous {
  
 
2220 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2221 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'list_diary.pl';
  
 
2222 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2223 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2224 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_diary_previous();
  
 
2225 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2226 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2227 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_diary_monthly_menu {
  
 
2228 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2229 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'list_diary.pl';
  
 
2230 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2231 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2232 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_diary_monthly_menu();
  
 
2233 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2234 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2235 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_friend {
  
 
2236 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2237 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'list_friend.pl';
  
 
2238 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2239 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2240 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_friend();
  
 
2241 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2242 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2243 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_friend_next {
  
 
2244 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2245 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'list_friend.pl';
  
 
2246 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2247 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2248 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_friend_next();
  
 
2249 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2250 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2251 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_friend_previous {
  
 
2252 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2253 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'list_friend.pl';
  
 
2254 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2255 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2256 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_friend_previous();
  
 
2257 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2258 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2259 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_member {
  
 
2260 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
2261 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url     = 'list_member.pl';
  
 
2262 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url        = shift if (@_ and $_[0] ne 'refresh' and $_[0] ne 'id');
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2263 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	my $refresh = shift if (@_ and $_[0] eq 'refresh');
  
 
2264 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %param   = @_;
  
 
2265 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	if (defined($param{'id'}) and length($param{'id'}) and $url !~ /[\?\&]id=/) {
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2266 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$url .= ($url =~ /\?/) ? "&id=$param{'id'}" : "?id=$param{'id'}";
  
 
2267 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2268 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->get_standard_data('parse_list_member', qr/list_member\.pl/, $url, $refresh);
  
 
2269 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2270 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2271 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_member_next {
  
 
2272 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
2273 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url     = 'list_member.pl';
  
 
2274 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url        = shift if (@_ and $_[0] ne 'refresh' and $_[0] ne 'id');
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2275 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	my $refresh = shift if (@_ and $_[0] eq 'refresh');
  
 
2276 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %param   = @_;
  
 
2277 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	if (defined($param{'id'}) and length($param{'id'}) and $url !~ /[\?\&]id=/) {
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2278 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$url .= ($url =~ /\?/) ? "&id=$param{'id'}" : "?id=$param{'id'}";
  
 
2279 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2280 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, $refresh) or return;
  
 
2281 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_member_next();
  
 
2282 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2283 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2284 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_member_previous {
  
 
2285 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
2286 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url     = 'list_member.pl';
  
 
2287 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url        = shift if (@_ and $_[0] ne 'refresh' and $_[0] ne 'id');
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2288 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	my $refresh = shift if (@_ and $_[0] eq 'refresh');
  
 
2289 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %param   = @_;
  
 
2290 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	if (defined($param{'id'}) and length($param{'id'}) and $url !~ /[\?\&]id=/) {
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2291 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$url .= ($url =~ /\?/) ? "&id=$param{'id'}" : "?id=$param{'id'}";
  
 
2292 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2293 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, $refresh) or return;
  
 
2294 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_member_previous();
  
 
2295 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2296 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2297 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_message {
  
 
2298 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2299 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'list_message.pl';
  
 
2300 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2301 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2302 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_message();
  
 
2303 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2304 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2305 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_outbox {
  
 
2306 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2307 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'list_message.pl?box=outbox';
  
 
2308 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2309 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2310 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_outbox();
  
 
2311 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2312 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2313 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_list_request {
  
 
2314 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2315 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'list_request.pl';
  
 
2316 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2317 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2318 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_list_request();
  
 
2319 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2320 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2321 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_new_album {
  
 
2322 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2323 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'new_album.pl';
  
 
2324 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2325 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2326 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_new_album();
  
 
2327 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2328 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2329 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_new_bbs {
  
 
2330 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2331 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'new_bbs.pl';
  
 
2332 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2333 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2334 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_new_bbs();
  
 
2335 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2336 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2337 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_new_bbs_next {
  
 
2338 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2339 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'new_bbs.pl';
  
 
2340 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2341 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2342 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_new_bbs_next();
  
 
2343 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2344 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2345 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_new_bbs_previous {
  
 
2346 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2347 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'new_bbs.pl';
  
 
2348 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2349 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2350 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_new_bbs_previous();
  
 
2351 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2352 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2353 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_new_comment {
  
 
2354 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2355 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'new_comment.pl';
  
 
2356 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2357 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2358 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_new_comment();
  
 
2359 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2360 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2361 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_new_friend_diary {
  
 
2362 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2363 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'new_friend_diary.pl';
  
 
2364 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2365 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2366 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_new_friend_diary();
  
 
2367 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2368 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2369 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_new_friend_diary_next {
  
 
2370 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2371 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'new_friend_diary.pl';
  
 
2372 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2373 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2374 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_new_friend_diary_next();
  
 
2375 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2376 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2377 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_new_friend_diary_previous {
  
 
2378 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2379 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'new_friend_diary.pl';
  
 
2380 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2381 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2382 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_new_friend_diary_previous();
  
 
2383 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2384 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2385 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_new_review {
  
 
2386 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2387 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'new_review.pl';
  
 
2388 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2389 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2390 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_new_review();
  
 
2391 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2392 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2393 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_release_info {
  
 
2394 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2395 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'release_info.pl';
  
 
2396 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2397 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2398 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_release_info();
  
 
2399 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2400 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2401 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_self_id {
  
 
2402 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2403 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->login unless ($self->is_logined);
  
 
2404 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_self_id();
  
 
2405 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2406 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2407 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_search_diary {
  
 
2408 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
2409 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url     = 'search_diary.pl';
  
 
2410 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url        = shift if (@_ and $_[0] ne 'refresh' and $_[0] ne 'keyword');
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2411 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	my $refresh = shift if (@_ and $_[0] eq 'refresh');
  
 
2412 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %param   = @_;
  
 
2413 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	if (defined($param{'keyword'}) and length($param{'keyword'}) and $url !~ /[\?\&]keyword=/) {
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2414 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$param{'keyword'} =~ s/([^\w ])/'%' . unpack('H2', $1)/eg;
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2415 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$param{'keyword'} =~ tr/ /+/;
  
 
2416 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$url .= ($url =~ /\?/) ? "&keyword=$param{'keyword'}" : "?keyword=$param{'keyword'}";
  
 
2417 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2418 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	@_ = grep { defined($_) } ($url, $refresh);
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2419 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response(@_) or return;
  
 
2420 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_search_diary();
  
 
2421 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2422 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2423 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_search_diary_next {
  
 
2424 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2425 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url     = 'search_diary.pl';
  
 
2426 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url        = shift if (@_ and $_[0] ne 'refresh' and $_[0] ne 'keyword');
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2427 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	my $refresh = shift if (@_ and $_[0] eq 'refresh');
  
 
2428 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %param   = @_;
  
 
2429 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	if (defined($param{'keyword'}) and length($param{'keyword'}) and $url !~ /[\?\&]keyword=/) {
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2430 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$param{'keyword'} =~ s/([^\w ])/'%' . unpack('H2', $1)/eg;
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2431 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$param{'keyword'} =~ tr/ /+/;
  
 
2432 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$url .= ($url =~ /\?/) ? "&keyword=$param{'keyword'}" : "?keyword=$param{'keyword'}";
  
 
2433 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2434 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, $refresh) or return;
  
 
2435 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_search_diary_next();
  
 
2436 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2437 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2438 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_search_diary_previous {
  
 
2439 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2440 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url     = 'search_diary.pl';
  
 
2441 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url        = shift if (@_ and $_[0] ne 'refresh' and $_[0] ne 'keyword');
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2442 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	my $refresh = shift if (@_ and $_[0] eq 'refresh');
  
 
2443 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %param   = @_;
  
 
2444 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	if (defined($param{'keyword'}) and length($param{'keyword'}) and $url !~ /[\?\&]keyword=/) {
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2445 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$param{'keyword'} =~ s/([^\w ])/'%' . unpack('H2', $1)/eg;
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2446 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$param{'keyword'} =~ tr/ /+/;
  
 
2447 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$url .= ($url =~ /\?/) ? "&keyword=$param{'keyword'}" : "?keyword=$param{'keyword'}";
  
 
2448 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2449 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, $refresh) or return;
  
 
2450 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_search_diary_previous();
  
 
2451 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2452 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2453 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_show_calendar {
  
 
2454 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2455 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'show_calendar.pl';
  
 
2456 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2457 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2458 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_show_calendar();
  
 
2459 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2460 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2461 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_show_calendar_term {
  
 
2462 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2463 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'show_calendar.pl';
  
 
2464 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2465 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2466 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_show_calendar_term();
  
 
2467 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2468 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2469 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_show_calendar_next {
  
 
2470 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2471 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'show_calendar.pl';
  
 
2472 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2473 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2474 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_show_calendar_next();
  
 
2475 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2476 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2477 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_show_calendar_previous {
  
 
2478 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2479 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'show_calendar.pl';
  
 
2480 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2481 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2482 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_show_calendar_previous();
  
 
2483 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2484 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2485 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_show_intro {
  
 
2486 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2487 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'show_intro.pl';
  
 
2488 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2489 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2490 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_show_intro();
  
 
2491 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2492 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2493 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_show_log {
  
 
2494 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2495 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'show_log.pl';
  
 
2496 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2497 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2498 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_show_log();
  
 
2499 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2500 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2501 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_show_log_count {
  
 
2502 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2503 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = 'show_log.pl';
  
 
2504 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     = shift if (@_ and $_[0] ne 'refresh');
  
 
2505 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2506 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_show_log_count();
  
 
2507 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2508 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2509 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_show_friend_outline {
  
 
2510 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2511 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $url  = shift or return undef;
  
 
2512 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return undef;
  
 
2513 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_show_friend_outline();
  
 
2514 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2515 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2516 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_show_friend_profile {
  
 
2517 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2518 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $url  = shift or return undef;
  
 
2519 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return undef;
  
 
2520 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_show_friend_profile();
  
 
2521 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2522 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2523 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_view_album {
  
 
2524 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
2525 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url     = 'view_album.pl';
  
 
2526 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url        = shift if (@_ and $_[0] ne 'refresh' and $_[0] ne 'id');
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2527 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	my $refresh = shift if (@_ and $_[0] eq 'refresh');
  
 
2528 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %param   = @_;
  
 
2529 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	if (defined($param{'id'}) and length($param{'id'}) and $url !~ /[\?\&]id=/) {
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2530 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$url .= ($url =~ /\?/) ? "&id=$param{'id'}" : "?id=$param{'id'}";
  
 
2531 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2532 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->get_standard_data('parse_view_album', qr/view_album\.pl/, $url, $refresh);
  
 
2533 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2534 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2535 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_view_album_comment {
  
 
2536 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2537 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url     = 'view_album.pl';
  
 
2538 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url        = shift if (@_ and $_[0] ne 'refresh' and $_[0] ne 'id');
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2539 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	my $refresh = shift if (@_ and $_[0] eq 'refresh');
  
 
2540 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %param   = @_;
  
 
2541 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	if (defined($param{'id'}) and length($param{'id'}) and $url !~ /[\?\&]id=/) {
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2542 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$url .= ($url =~ /\?/) ? "&id=$param{'id'}" : "?id=$param{'id'}&mode=comment";
  
 
2543 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2544 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->get_standard_data('parse_view_album_comment', qr/view_album\.pl/, $url, $refresh);
  
 
2545 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2546 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2547 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_view_album_photo {
  
 
2548 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2549 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url     = 'view_album.pl';
  
 
2550 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url        = shift if (@_ and $_[0] ne 'refresh' and $_[0] ne 'id');
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2551 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	my $refresh = shift if (@_ and $_[0] eq 'refresh');
  
 
2552 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %param   = @_;
  
 
2553 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	if (defined($param{'id'}) and length($param{'id'}) and $url !~ /[\?\&]id=/) {
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2554 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$url .= ($url =~ /\?/) ? "&id=$param{'id'}" : "?id=$param{'id'}";
  
 
2555 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2556 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->get_standard_data('parse_view_album_photo', qr/view_album\.pl/, $url, $refresh);
  
 
2557 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2558 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2559 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_view_bbs {
  
 
2560 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2561 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $url  = shift or return;
  
 
2562 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return undef;
  
 
2563 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_view_bbs();
  
 
2564 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2565 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2566 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_view_community {
  
 
2567 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2568 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url     = 'view_community.pl';
  
 
2569 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url        = shift if (@_ and $_[0] ne 'refresh' and $_[0] ne 'id');
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2570 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	my $refresh = shift if (@_ and $_[0] eq 'refresh');
  
 
2571 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %param   = @_;
  
 
2572 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	if (defined($param{'id'}) and length($param{'id'}) and $url !~ /[\?\&]id=/) {
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
2573 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$url .= ($url =~ /\?/) ? "&id=$param{'id'}" : "?id=$param{'id'}";
  
 
2574 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2575 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->get_standard_data('parse_view_community', qr/view_community\.pl/, $url, $refresh);
  
 
2576 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2577 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2578 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_view_diary {
  
 
2579 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2580 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $url  = shift or return;
  
 
2581 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return undef;
  
 
2582 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_view_diary();
  
 
2583 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2584 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2585 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_view_event {
  
 
2586 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2587 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $url  = shift or return;
  
 
2588 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return undef;
  
 
2589 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_view_event();
  
 
2590 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2591 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2592 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_view_message {
  
 
2593 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2594 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $url  = shift or return undef;
  
 
2595 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return undef;
  
 
2596 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_view_message();
  
 
2597 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2598 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2599 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_view_message_form {
  
 
2600 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2601 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $url  = shift or return;
  
 
2602 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return;
  
 
2603 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_view_message_form();
  
 
2604 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2605 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2606 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_add_diary_preview {
  
 
2607 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self        = shift;
  
 
2608 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %form        = @_;
  
 
2609 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$form{'submit'} = 'main';
  
 
2610 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $response    = $self->post_add_diary(%form);
  
 
2611 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return if ($@ or not $response);
  
 
2612 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_add_diary_preview();
  
 
2613 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2614 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2615 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_add_diary_confirm {
  
 
2616 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self  = shift;
  
 
2617 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my %form  = (ref($_[0]) eq 'HASH') ? %{$_[0]} : @_;
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2618 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url   = 'add_diary.pl';
  
 
2619 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @files = qw(photo1 photo2 photo3);
  
 
2620 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# POSTキー未取得、または写真があればプレビュー投稿
  
 
2621 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	if (not $form{'post_key'} or grep { $form{$_} } @files) {
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2622 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @forms = grep {$_->{'submit'} eq 'confirm'} $self->get_add_diary_preview(%form);
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2623 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		return 0 if ($self->response->is_error);
  
 
2624 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		return 0 unless (@forms);
  
 
2625 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		%form = %{$forms[0]};
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2626 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$self->log("[info] プレビューページを取得しました。\n");
  
 
2627 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$self->dumper_log(\%form);
  
 
2628 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2629 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# 投稿
  
 
2630 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$form{'submit'} = 'confirm';
  
 
2631 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->post_add_diary(%form) or return;
  
 
2632 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_add_diary_confirm();
  
 
2633 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2634 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2635 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_delete_diary_preview {
  
 
2636 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2637 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %form = @_;
  
 
2638 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->post_delete_diary(%form) or return;
  
 
2639 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_delete_diary_preview();
  
 
2640 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2641 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2642 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_delete_diary_confirm {
  
 
2643 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self  = shift;
  
 
2644 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %form  = @_;
  
 
2645 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# 投稿
  
 
2646 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$form{'submit'} = 'confirm';
  
 
2647 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->post_delete_diary(%form) or return;
  
 
2648 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_delete_diary_confirm();
  
 
2649 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2650 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2651 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_edit_diary_preview {
  
 
2652 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2653 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $url  = shift or return undef;
  
 
2654 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$url =~ s/view_diary.pl\?(?:.*&)?(id=\d+).*?$/edit_diary.pl?$1/;
  
 
2655 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return undef;
  
 
2656 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_edit_diary_preview();
  
 
2657 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2658 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2659 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_edit_diary_image {
  
 
2660 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2661 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $url  = shift or return undef;
  
 
2662 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or return undef;
  
 
2663 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_edit_diary_image();
  
 
2664 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2665 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2666 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_edit_diary_confirm {
  
 
2667 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self  = shift;
  
 
2668 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %form  = @_;
  
 
2669 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# 投稿
  
 
2670 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$form{'submit'} = 'main';
  
 
2671 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->post_edit_diary(%form) or return;
  
 
2672 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_edit_diary_confirm();
  
 
2673 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2674 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2675 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_send_message_preview {
  
 
2676 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2677 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %form = @_;
  
 
2678 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$form{'submit'} = 'main';
  
 
2679 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->post_send_message(%form) or return;
  
 
2680 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_send_message_preview();
  
 
2681 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2682 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2683 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_send_message_confirm {
  
 
2684 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2685 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my %form = (ref($_[0]) eq 'HASH') ? %{$_[0]} : @_;
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2686 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$form{'submit'} = 'confirm';
  
 
2687 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$form{'yes'}    = ' 送 信 ' unless ($form{'yes'});
  
 
2688 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	#post key未取得ならプレビュー投稿
  
 
2689 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	if (not $form{'post_key'} or not $form{'yes'}) {
  
 
2690 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @forms = grep {$_->{'submit'} eq 'confirm'} $self->get_send_message_preview(%form);
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2691 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		return 0 if ($self->response->is_error);
  
 
2692 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		return 0 unless (@forms);
  
 
2693 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		%form = %{$forms[0]};
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2694 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$self->log("[info] プレビューページを取得しました。\n");
  
 
2695 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$self->dumper_log(\%form);
  
 
2696 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2697 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# 送信
  
 
2698 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->post_send_message(%form) or return;
  
 
2699 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->parse_send_message_confirm();
  
 
2700 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2701 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2702 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_parser_params {
  
 
2703 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self     = shift;
  
 
2704 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @params   = @_;
  
 
2705 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $response = undef;
  
 
2706 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content  = undef;
  
 
2707 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $param (@params) {
  
 
2708 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if (UNIVERSAL::isa($param, 'HTTP::Response')) {
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
2709 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$response = $param;
  
 
2710 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		} elsif (not ref($param)) { # File or Content
  
 
2711 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 			if ($param !~ /\t\r\n/ and -f $param) {
  
 
2712 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 				if (open(IN, $param)) { # Slurp file
  
 
2713 
 
0
 
 
 
 
 
 
 
 
 
 
 
 					local $/;
  
 
2714 
 
0
 
 
 
 
 
 
 
 
 
 
 
 					$content = ;
   
 
2715 
 
0
 
 
 
 
 
 
 
 
 
 
 
 					close(IN);
  
 
2716 
 
 
 
 
 
 
 
 
 
 
 
 
 
 				}
  
 
2717 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			} else {
  
 
2718 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$content = $param;
  
 
2719 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
2720 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
2721 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2722 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$response = ($content or not $self->response) ? HTTP::Response->new(200) : $self->response unless ($response);
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
2723 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$response->content($content)   if ($content);
  
 
2724 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$content  = $response->content if (not $content);
  
 
2725 
 
0
 
 
 
  
  0
   
 
 
 
 
 
 
 
 	my $base = eval { $response->base->as_string } || 'http://mixi.jp/';
  
 
2726 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = eval { $response->request->uri->as_string };
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2727 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return ($response, $content, $url, $base);
  
 
2728 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2729 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2730 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub absolute_url {
  
 
2731 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2732 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = shift;
  
 
2733 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $base = (@_) ? shift : $self->{'mixi'}->{'base'};
  
 
2734 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return undef unless (length($url));
  
 
2735 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$url     =~ s/(^["']*|['"]*$)//g;
  
 
2736 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$url     .= '.pl' if ($url and $url !~ /[\/\.]/);
  
 
2737 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return URI->new($url)->abs($base)->as_string;
  
 
2738 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2739 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2740 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub absolute_linked_url {
  
 
2741 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2742 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = shift;
  
 
2743 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return $url unless ($url and $self->response());
  
 
2744 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base = $self->response->base->as_string;
  
 
2745 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->absolute_url($url, $base);
  
 
2746 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2747 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2748 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub query_sorted_url {
  
 
2749 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2750 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url  = shift;
  
 
2751 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return undef unless ($url);
  
 
2752 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($url =~ s/\?(.*)$//) {
  
 
2753 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $qurey_string = join('&', map {join('=', @{$_})}
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2754 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			map { $_->[1] =~ s/%20/+/g if @{$_} == 2; $_; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2755 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			sort {$a->[0] cmp $b->[0]}
  
 
2756 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			map {[split(/=/, $_, 2)]} split(/&/, $1));
  
 
2757 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$url = "$url?$qurey_string";
  
 
2758 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2759 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $url;
  
 
2760 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2761 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2762 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub enable_cookies {
  
 
2763 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2764 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	unless ($self->cookie_jar) {
  
 
2765 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $cookie = sprintf('cookie_%s_%s.txt', $$, time);
  
 
2766 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$self->cookie_jar(HTTP::Cookies->new(file => $cookie, ignore_discard => 1));
  
 
2767 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$self->log("[info] Cookieを有効にしました。\n");
  
 
2768 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2769 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self;
  
 
2770 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2771 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2772 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub save_cookies {
  
 
2773 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2774 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $file = shift;
  
 
2775 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $info = '';
  
 
2776 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $result = 0;
  
 
2777 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if (not $self->cookie_jar) {
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
2778 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$info = "[error] Cookieが無効です。\n";
  
 
2779 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} elsif (not $file) {
  
 
2780 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$info = "[error] Cookieを保存するファイル名が指定されませんでした。\n";
  
 
2781 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} else {
  
 
2782 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$info = "[info] Cookieを\"${file}\"に保存します。\n";
  
 
2783 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$result = eval "\$self->cookie_jar->save(\$file)";
  
 
2784 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$info .= "[error] $@\n" if ($@);
  
 
2785 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2786 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $result;
  
 
2787 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2788 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2789 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub load_cookies {
  
 
2790 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2791 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $file = shift;
  
 
2792 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $info = '';
  
 
2793 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $result = 0;
  
 
2794 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if (not $file){ 
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
2795 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$info = "[error] Cookieを読み込むファイル名が指定されませんでした。\n";
  
 
2796 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} elsif (not $file) {
  
 
2797 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$info = "[error] Cookieファイル\"${file}\"が存在しません。\n";
  
 
2798 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} else {
  
 
2799 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$info = "[info] Cookieを\"${file}\"から読み込みます。\n";
  
 
2800 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$self->enable_cookies;
  
 
2801 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$result = eval "\$self->cookie_jar->load(\$file)";
  
 
2802 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$info .= "[error] $@\n" if ($@);
  
 
2803 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2804 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $result;
  
 
2805 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2806 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2807 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub log {
  
 
2808 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2809 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $logger = $self->{'mixi'}->{'log'} or return;
  
 
2810 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	if    (ref($logger) eq 'CODE')                         { &{$logger}($self, @_); }
  
 
  
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2811 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	elsif (ref($logger) eq '' and $logger =~ /^[1-9]\d*$/) { $self->callback_log(@_); }
  
 
2812 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return;
  
 
2813 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2814 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2815 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub callback_log {
  
 
2816 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self  = shift;
  
 
2817 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @logs  = @_;
  
 
2818 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $jconv = $self->{'mixi'}->{'ref_convert'};
  
 
2819 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $level = (ref($self->{'mixi'}->{'log'}) eq '') ? $self->{'mixi'}->{'log'} : 1;
  
 
2820 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $error = 0;
  
 
2821 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $log (@logs) {
  
 
2822 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $log_level = 0;
  
 
2823 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if    ($log !~ /^(\s|\[.*?\])/) { $log_level = 1; }
  
 
  
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
2824 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		elsif ($log =~ /^\[error\]/)    { $log_level = 1; $error = 1; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2825 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		elsif ($log =~ /^\[usage\]/)    { $log_level = 2; }
  
 
2826 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		elsif ($log =~ /^\[warn\]/)     { $log_level = 2; }
  
 
2827 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		elsif ($log =~ /^\[info\]/)     { $log_level = 3; }
  
 
2828 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		elsif ($log =~ /^\s/)           { $log_level = 4; }
  
 
2829 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		else                            { $log_level = 5; }
  
 
2830 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 		if ($log_level and $log_level <= $level) {
  
 
2831 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$log = $self->jconv_log($log);
  
 
2832 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			print $log;
  
 
2833 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
2834 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2835 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->abort if ($error);
  
 
2836 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return;
  
 
2837 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2838 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2839 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub jconv_log {
  
 
2840 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2841 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $log  = shift;
  
 
2842 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $code = $self->{'mixi'}->{'logcode'};
  
 
2843 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $log unless ($code);
  
 
2844 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $log if ($log =~ /(?:\QCan't use Jcode module\E|\QJcode can't handle\E)/);
  
 
2845 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# initialize Jcode
  
 
2846 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if (not exists($self->{'mixi'}->{'ref_convert'})) {
  
 
2847 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$self->log("[info] Initialize Jcode for logging with '$code'.\n");
  
 
2848 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		eval "use Jcode";
  
 
2849 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if    ($@)                    { $self->log("[warn] Can't use Jcode module.\n"); }
  
 
  
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
2850 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		elsif (not Jcode->can($code)) { $self->log("[warn] Jcode can't handle '$code'.\n"); }
  
 
2851 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		else  { $self->{'mixi'}->{'ref_convert'} = Jcode->can('convert'); }
  
 
2852 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2853 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $log if (ref($self->{'mixi'}->{'ref_convert'}) ne 'CODE');
  
 
2854 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# convert
  
 
2855 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $jconv = $self->{'mixi'}->{'ref_convert'};
  
 
2856 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$log = &{$jconv}($log, $code, 'euc') if ($jconv);
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2857 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $log;
  
 
2858 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2859 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2860 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub dumper_log {
  
 
2861 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2862 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @logs = @_;
  
 
2863 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if (not defined($self->{'mixi'}->{'dumper'})) {
  
 
2864 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$self->log("Data::Dumperを初期化します。\n");
  
 
2865 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		eval "use Data::Dumper";
  
 
2866 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if ($@) {
  
 
2867 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$self->{'mixi'}->{'dumper'} = 0;
  
 
2868 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$self->log("[warn] Data::Dumperは使用できません : $@\n");
  
 
2869 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		} else {
  
 
2870 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$self->{'mixi'}->{'dumper'} = Data::Dumper->new([]);
  
 
2871 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			eval { $self->{'mixi'}->{'dumper'}->Indent(1); $self->{'mixi'}->{'dumper'}->Sortkeys(1); };
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2872 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
2873 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2874 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($self->{'mixi'}->{'dumper'}) {
  
 
2875 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $log = $self->{'mixi'}->{'dumper'}->Reset->Values([@logs])->Dump;
  
 
2876 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$log =~ s/(?:\x0D\x0A?|\x0A)/\n  /gs;
  
 
2877 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$log =~ s/\s*$/\n/s;
  
 
2878 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		return $self->log("  $log");
  
 
2879 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} else {
  
 
2880 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		@logs = map { s/\s*$/\n/s; s/(?:\x0D\x0A?|\x0A)/\n  /gs; $_ = "  [dumper] $_"; } @logs;
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2881 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		return $self->log(@logs);
  
 
2882 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2883 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2884 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2885 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub abort {
  
 
2886 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2887 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return &{$self->{'mixi'}->{'abort'}}($self, @_);
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2888 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2889 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2890 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub callback_abort {
  
 
2891 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	die @_;
  
 
2892 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2893 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2894 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub rewrite {
  
 
2895 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2896 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return &{$self->{'mixi'}->{'rewrite'}}($self, @_);
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
2897 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2898 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2899 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub callback_rewrite {
  
 
2900 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2901 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $str  = shift;
  
 
2902 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$str = $self->remove_tag($str);
  
 
2903 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$str = $self->unescape($str);
  
 
2904 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$str =~ s/\x0d\x0a?|\x0a/\n/g;
  
 
2905 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$str =~ s/\s+$//s;
  
 
2906 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $str;
  
 
2907 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2908 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2909 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub escape {
  
 
2910 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2911 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $str  = shift;
  
 
2912 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %escaped = ('&' => '&', '"' => '"', '>' => '>', '<' => '<');
  
 
2913 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_target = join('|', keys(%escaped));
  
 
2914 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$str =~ s/($re_target)/$escaped{$1}/g;
  
 
2915 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $str;
  
 
2916 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2917 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2918 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub unescape {
  
 
2919 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2920 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $str  = shift;
  
 
2921 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %unescaped = ('amp' => '&', 'quot' => '"', 'gt' => '>', 'lt' => '<', 'nbsp' => ' ', 'apos' => "'", 'copy' => '(c)');
  
 
2922 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_target = join('|', keys(%unescaped));
  
 
2923 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$str =~ s/&($re_target|#x([0-9a-z]+));/defined($unescaped{$1}) ? $unescaped{$1} : defined($2) ? chr(hex($2)) : "&$1;"/ige;
  
 
  
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
2924 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $str;
  
 
2925 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2926 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2927 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub remove_tag {
  
 
2928 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2929 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $html = shift;
  
 
2930 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $text = '';
  
 
2931 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $indent = '';
  
 
2932 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $blockquote = 0;
  
 
2933 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_standard_tag = q{[^"'<>]*(?:"[^"]*"[^"'<>]*|'[^']*'[^"'<>]*)*(?:>|(?=<)|$(?!\n))};
  
 
2934 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_comment_tag = '-]*(?:-[^>-]+)*?)??)*(?:>|$(?!\n)|--.*$)';
  
 
2935 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_html_tag = qq{$re_comment_tag|<$re_standard_tag};
  
 
2936 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	while ($html =~ /([^<]*)($re_html_tag)?/gso) {
  
 
2937 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 		last if ($1 eq '' and $2 eq '');
  
 
2938 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my ($tmp_text, $tmp_tag) = ($1, $2);
  
 
2939 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$tmp_text =~ s/\n/\n$indent/go if ($indent);
  
 
2940 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$text .= $tmp_text;
  
 
2941 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if ($tmp_tag =~ /^<(\/?)blockquote[ >]/i) {
  
 
2942 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$blockquote += ($1) ? -1 : 1;
  
 
2943 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$indent = ($blockquote > 0) ? '>' x $blockquote . ' ' : '';
  
 
2944 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$text .= ($1) ? "\n\n" : "\n\n$indent";
  
 
2945 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
2946 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2947 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $text;
  
 
2948 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2949 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2950 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub remove_diary_tag {
  
 
2951 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
2952 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $str  = shift;
  
 
2953 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_diary_tag = join('|', 
  
 
2954 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		q{},
   
 
2955 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		q{},
   
 
2956 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		q{ 
 
2957 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		q{},
   
 
2958 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		q{<(?:blockquote|u|em|strong)>},
  
 
2959 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		q{<\/(?:a|blockquote|u|em|span|strong)>}
  
 
2960 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	);
  
 
2961 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$str =~ s/$re_diary_tag//g;
  
 
2962 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $str;
  
 
2963 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2964 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2965 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub redirect_ok {
  
 
2966 
 
0
 
 
 
 
 
  
0
   
 
  
1
   
 
 
 
 	return 1;
  
 
2967 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2968 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2969 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub get_standard_data {
  
 
2970 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# default url is pased, so url is not necessary.
  
 
2971 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
2972 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $parser  = shift;
  
 
2973 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $def_url = shift;                                    # defined url
  
 
2974 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	my $url     = shift if (@_ and $_[0] ne 'refresh');     # specified url
  
 
2975 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	if (defined($def_url) and ref($def_url) eq 'Regexp') {
  
 
  
 
 
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
    
 
2976 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 		return unless (defined($url) and length($url));
  
 
2977 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		return unless ($url =~ $def_url);
  
 
2978 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} elsif (not (ref($url) eq '' and length($url))) {
  
 
2979 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$url = $def_url;
  
 
2980 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
2981 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$self->abort("url \"$url\" is invalid.") unless (defined($url) and length($url));     # invalid url
  
 
2982 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->can($parser) or $self->abort("parser \"$parser\" is not available.");          # invalid method
  
 
2983 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$self->set_response($url, @_) or $self->abort("set_response failed.");                # request can not processed
  
 
2984 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->$parser();
  
 
2985 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
2986 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
2987 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_standard_history {
  
 
2988 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
2989 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
2990 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
2991 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
2992 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
2993 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
2994 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_date = '(?:(\d{4})年)?(\d{2})月(\d{2})日 (\d{1,2}):(\d{2})';
  
 
2995 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_link = ']*href="?([^<> ]*?)"?(?: [^<>]*)?>(.*?)<\/a>';
   
 
2996 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_name = '\(([^<>]*)\)';
  
 
2997 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @today = reverse((localtime)[3..5]);
  
 
2998 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$today[0] += 1900;
  
 
2999 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$today[1] += 1;
  
 
3000 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# get standard history part
  
 
3001 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_from = qq(\Q\E);
 
3002 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content_till = qq(\Q<\/table>\E);
  
 
3003 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return $self->log("[warn] standard history part is missing.\n") unless ($content =~ /$content_from(.*?)$content_till/s);
  
 
3004 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$content = $1;
  
 
3005 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# parse standard history part
  
 
3006 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $row ($content =~ /  (.*?)<\/tr>/isg) {
 
 
3007 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$row =~ s/\s*[\r\n]\s*//gs;
  
 
3008 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @cols = ($row =~ / ]*>(.*?)<\/td>/gs);
  
 
3009 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $item = {};
  
 
3010 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		next unless ($cols[0] =~ s/$re_date//);
  
 
3011 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @date           = ($1, $2, $3, $4, $5);
  
 
3012 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		next unless ($cols[1] =~ /${re_link}\s*$re_name/);
  
 
3013 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$item->{'link'}    = $self->absolute_url($1, $base);
  
 
3014 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 		$item->{'subject'} = (defined($2) and length($2)) ? $self->rewrite($2) : '(削除)';
  
 
3015 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$item->{'name'}    = $self->rewrite($3);
  
 
3016 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$date[0]           = ($date[1] > $today[1]) ? $today[0] - 1 : $today[0] if (not defined($date[0]));
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
3017 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$item->{'time'}    = sprintf('%04d/%02d/%02d %02d:%02d', @date);
  
 
3018 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		map { $item->{$_} =~ s/^\s+|\s+$//gs } (keys(%{$item}));
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3019 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if ($cols[1] =~ /(]*>)\s*(  
 
3020 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $image = {};
  
 
3021 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my @tags = ($1, $2);
  
 
3022 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 			if ($_ = $self->parse_standard_tag($tags[0]) and $_->{'attr'}->{'href'} or $_->{'attr'}->{'onclick'}) {
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
3023 
 
 
 
 
 
 
 
 
 
 
 
 
 
 #				$_ = ($_->{'attr'}->{'onclick'}) ? $_->{'attr'}->{'onclick'} : $_->{'attr'}->{'href'};
  
 
3024 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$_ = $_->{'attr'}->{'href'};
  
 
3025 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 				$_ = $1 if ($_ =~ /MM_openBrWindow\('(.*?)'/);
  
 
3026 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$item->{'image'}->{'link'} = $self->absolute_url($_, $base);
  
 
3027 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
3028 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 			$item->{'image'}->{'src'}  = $self->absolute_url($_, $base) if ($_ = $self->parse_standard_tag($tags[1]) and $_ = $_->{'attr'}->{'src'});
  
 
3029 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
3030 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		push(@items, $item);
  
 
3031 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3032 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
3033 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3034 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3035 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_standard_history_next {
  
 
3036 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
3037 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
3038 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
3039 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
3040 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
3041 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($content =~ / [^\r\n]*?]+?)['"]?>([^<>]+)<\/a><\/td><\/tr>/);
   
 
3042 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $subject = $2;
  
 
3043 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $link    = $self->absolute_url($1, $base);
  
 
3044 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $next    = {'link' => $link, 'subject' => $2};
  
 
3045 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $next;
  
 
3046 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3047 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3048 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_standard_history_previous {
  
 
3049 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self     = shift;
  
 
3050 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res      = (@_) ? shift : $self->response();
  
 
3051 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
3052 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base     = $res->request->uri->as_string;
  
 
3053 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content  = $res->content;
  
 
3054 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return unless ($content =~ / ([^<>]+)<\/a>[^\r\n]*?<\/td><\/tr>/);
   
3055 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $subject  = $2;
  
 
3056 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $link     = $self->absolute_url($1, $base);
  
 
3057 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $previous = {'link' => $link, 'subject' => $2};
  
 
3058 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $previous;
  
 
3059 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3060 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3061 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_standard_form {
  
 
3062 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
3063 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $res     = (@_) ? shift : $self->response();
  
 
3064 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return unless ($res and $res->is_success);
  
 
3065 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $base    = $res->base->as_string;
  
 
3066 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $content = $res->content;
  
 
3067 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items   = ();
  
 
3068 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	if ($res->is_success and $content =~ /  .*? 
3069 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $message = $1;
  
 
3070 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$message =~ s/\n//g;
  
 
3071 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$message =~ s/ 
 
3072 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$res->code(400);
  
 
3073 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$res->message($self->rewrite($message));
  
 
3074 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		return;
  
 
3075 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3076 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	while ($content =~ s/( 
 
3077 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $tag    = $1;
  
 
3078 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $form   = $2;
  
 
3079 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my $action = ($tag =~ /\baction=("[^"]*"|'[^']*'|[^'"<> ]*)/) ? $1 : "";
  
 
3080 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$action    =~ s/^"(.*)"$/$1/s or $action =~ s/^'(.*)'$/$1/s;
  
 
3081 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $item   = {'__action__' => $self->absolute_url($action, $base)};
  
 
3082 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		foreach my $tag ($form =~ / 
 
3083 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			my $name = ($tag =~ /\bname=("[^"]*"|'[^']*'|[^'"<> ]*)/) ? $1 : "";
  
 
3084 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			my $value = ($tag =~ /\bvalue=("[^"]*"|'[^']*'|[^'"<> ]*)/) ? $1 : "";
  
 
3085 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			($name, $value) = map { s/^"(.*)"$/$1/s or s/^'(.*)'$/$1/s; $_ } ($name, $value);
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3086 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$item->{$name} = $self->rewrite($value) if (length($name));
  
 
3087 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
3088 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		while ($form =~ s/ 
 
3089 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my ($attrs, $value) = ($1, $2);
  
 
3090 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			my $name = ($attrs =~ /\bname=("[^"]*"|'[^']*'|[^'"<> ]*)/) ? $1 : "";
  
 
3091 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			($name) = map { s/^"(.*)"$/$1/s or s/^'(.*)'$/$1/s; $_ } ($name);
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3092 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$item->{$name} = $self->rewrite($value) if (length($name));
  
 
3093 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
3094 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		push(@items, $item);
  
 
3095 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3096 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return @items;
  
 
3097 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3098 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3099 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_standard_tag {
  
 
3100 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
3101 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $str = shift;
  
 
3102 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return undef unless ($str =~ s/^\s*<(.*)>\s*$/$1/s);
  
 
3103 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return undef if ($str =~ /^\!--/);
  
 
3104 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_word  = q{[^"'<>\s=]+};                             #"]}
  
 
3105 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_quote = q{(?:"[^"]*"|'[^']*')};                     #")}
  
 
3106 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_pair  = qq{$re_word\\s*=\\s*(?:$re_quote|$re_word\\((?:[^)]*|$re_quote)*\\)|[^"'<>\\s]+)?};
  
 
3107 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $re_parse = qq{$re_pair|$re_word|$re_quote};
  
 
3108 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @parsed = ($str =~ /$re_parse/gs);
  
 
3109 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $tag = lc(shift(@parsed));
  
 
3110 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	@parsed = map { /^($re_word)\s*=\s*(.*)$/ ? (lc($1) => $2) : (lc($_) => '') } @parsed;
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3111 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	@parsed = map { /^\s*=\s*$/ ? '=' :/^"(.*)"$/ ? $1 : /^'(.*)'$/ ? $1 : $_ } @parsed;
  
 
  
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
3112 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return { 'tag' => $tag, , 'attr' => {@parsed} };
  
 
3113 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3114 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3115 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub parse_standard_anchor {
  
 
3116 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self   = shift;
  
 
3117 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $str    = shift;
  
 
3118 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $parsed = $self->parse_standard_tag($str);
  
 
3119 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $link   = undef;
  
 
3120 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return undef unless ($parsed);
  
 
3121 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($parsed->{'attr'}->{'onclick'}) {
  
 
3122 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if    ($parsed->{'attr'}->{'onclick'} =~ /MM_openBrWindow\(("[^""]*"|'[^'']*'|[^\s\)]*)/)             { $link = $1; }
  
 
  
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
3123 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		elsif ($parsed->{'attr'}->{'onclick'} =~ /window.opener.location.href=("[^""]*"|'[^'']*'|[^\s\)]*)/i) { $link = $1; }
  
 
3124 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 		1 if (defined($link) and ($link =~ s/^"(.*?)"/$1/ or $link =~ s/^'(.*?)'/$1/));
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
3125 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3126 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$link = $parsed->{'attr'}->{'href'} if (not defined($link));
  
 
3127 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $link;
  
 
3128 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3129 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3130 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub set_response {
  
 
3131 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self    = shift;
  
 
3132 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url     = shift;
  
 
3133 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	my $refresh = (@_ and defined($_[0]) and $_[0] eq 'refresh') ? 1 : 0;
  
 
3134 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $latest  = ($self->response) ? $self->response->request->uri->as_string : undef;
  
 
3135 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$url        = $self->query_sorted_url($self->absolute_url($url));
  
 
3136 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return 0 unless ($url);
  
 
3137 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	return 1 if ($url eq $latest and not $refresh and $self->response->is_success);
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
3138 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$self->get($url);
  
 
3139 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return 0 unless ($self->response);
  
 
3140 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	return 0 unless ($self->response->is_success);
  
 
3141 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return 1;
  
 
3142 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3143 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3144 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub post_add_diary {
  
 
3145 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self     = shift;
  
 
3146 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %values   = @_;
  
 
3147 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url      = 'add_diary.pl';
  
 
3148 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @fields   = qw(submit diary_title diary_body photo1 photo2 photo3 orig_size packed post_key id news_id);
  
 
3149 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @required = qw(submit diary_title diary_body id);
  
 
3150 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @files    = qw(photo1 photo2 photo3);
  
 
3151 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %label    = ('diary_title' => '日記のタイトル', 'diary_body' => '日記の本文', 'photo1' => '写真1', 'photo2' => '写真2', 'photo3' => '写真3', orig_size => '圧縮指定', packed => '送信データ', 'post_key' => '送信キー', 'id' => 'mixiユーザーID');
  
 
3152 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @errors;
  
 
3153 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# データの生成とチェック
  
 
3154 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %form     = map { $_ => $values{$_} } @fields;
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3155 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$form{'id'}  = $self->parse_self_id;
  
 
3156 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	push @errors, map { "$label{$_}を指定してください。" } grep { not $form{$_} } @required;
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3157 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($form{'submit'} eq 'main') {
  
 
3158 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		# プレビュー用の追加処理
  
 
3159 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		foreach my $file (@files) {
  
 
3160 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			next unless ($form{$file});
  
 
3161 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			if (not -f $form{$file}) {
  
 
3162 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				push @errors, "[info] $label{$file}のファイル\"$form{$file}\"がありません。\n" ;
  
 
3163 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			} else {
  
 
3164 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$form{$file} = [$form{$file}];
  
 
3165 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
3166 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
3167 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3168 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if (@errors) {
  
 
3169 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$self->log(join('', @errors));
  
 
3170 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		return undef;
  
 
3171 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3172 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->post($url, %form);
  
 
3173 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3174 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3175 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub post_edit_diary {
  
 
3176 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self      = shift;
  
 
3177 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %values    = @_;
  
 
3178 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$self->dumper_log(\%values);
  
 
3179 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $url       = exists($values{'__action__'}) ? $values{'__action__'} : 'edit_diary.pl?id=' . $values{'id'};
  
 
3180 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @fields    = qw(submit diary_title diary_body form_date photo1 photo2 photo3 orig_size post_key);
  
 
3181 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @required  = qw(submit diary_title diary_body post_key);
  
 
3182 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @files     = qw(photo1 photo2 photo3);
  
 
3183 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %label     = ('id' => '日記ID', 'diary_title' => '日記のタイトル', 'diary_body' => '日記の本文', 'photo1' => '写真1', 'photo2' => '写真2', 'photo3' => '写真3', 'post_key' => '送信キー');
  
 
3184 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @errors;
  
 
3185 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# データの生成とチェック
  
 
3186 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %form     = map { $_ => $values{$_} } @fields;
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3187 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	push @errors, "[error] $label{'id'}を指定してください。\n" if ($url !~ /[\?&]id=\d+/);
  
 
3188 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	push @errors, map { "[error] $label{$_}を指定してください。\n" } grep { not $form{$_} } @required;
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3189 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# ファイル追加処理
  
 
3190 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	foreach my $file (@files) {
  
 
3191 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		next unless ($form{$file});
  
 
3192 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if (not -f $form{$file}) {
  
 
3193 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			push @errors, "[info] $label{$file}のファイル\"$form{$file}\"がありません。\n" ;
  
 
3194 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		} else {
  
 
3195 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$form{$file} = [$form{$file}];
  
 
3196 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
3197 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3198 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if (@errors) {
  
 
3199 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$self->log(join('', @errors));
  
 
3200 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		return undef;
  
 
3201 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3202 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->post($url, %form);
  
 
3203 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3204 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3205 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub post_delete_diary {
  
 
3206 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self     = shift;
  
 
3207 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %values   = @_;
  
 
3208 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $url      = 'delete_diary.pl';
  
 
3209 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @fields   = qw(submit id post_key);
  
 
3210 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @required = qw(id post_key);
  
 
3211 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %label    = ('id' => '日記ID', 'post_key' => '送信キー');
  
 
3212 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# データの生成とチェック
  
 
3213 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %form     = map {$_ => $values{$_}} @fields;
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3214 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	$form{'id'}  = $1 if ($values{'__action__'} and $values{'__action__'} =~ /delete_diary.pl?id=(\d+)/);
  
 
3215 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @errors   = map { "$label{$_}を指定してください。" } grep { not $form{$_} } @required;
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3216 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if (@errors) {
  
 
3217 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$self->log(map { "[warn] $_\n" } @errors);
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3218 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		return undef;
  
 
3219 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3220 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$url .= "?id=" . delete($form{'id'});
  
 
3221 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->post($url, %form);
  
 
3222 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3223 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3224 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub post_send_message {
  
 
3225 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self     = shift;
  
 
3226 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %values   = @_;
  
 
3227 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $url      = exists($values{'__action__'}) ? $values{'__action__'} : 'send_message.pl?id=' . $values{'id'};
  
 
3228 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @fields   = qw(submit subject body post_key yes no);
  
 
3229 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @required = qw(submit subject body);
  
 
3230 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %label    = ('id' => '受信者のID', 'subject' => 'メッセージのタイトル', 'body' => 'メッセージの本文', 'post_key' => '送信キー');
  
 
3231 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %form     = map { $_ => $values{$_} } @fields;
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3232 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @errors   = map { "$label{$_}を指定してください。" } grep { not $form{$_} } @required;
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3233 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	push(@errors, "$label{'id'}を指定してください。") if ($url !~ /[\?&]id=\d+/);
  
 
3234 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if (@errors) {
  
 
3235 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$self->log(map { "[warn] $_\n" } @errors);
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3236 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		return undef;
  
 
3237 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3238 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	delete($form{'no'}) if ($form{'yes'} and $form{'no'});  # プレビューを解析すると'yes'、'no'が両方入るため、択一
  
 
3239 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $self->post($url, %form);
  
 
3240 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3241 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3242 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub convert_login_time {
  
 
3243 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $self = shift;
  
 
3244 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $time = @_ ? shift : 0;
  
 
3245 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$time    =~ s/(^\s+|\s+$)//gs;
  
 
3246 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($time =~ /^\d+$/) { 1; }
  
 
  
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
3247 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	elsif ($time =~ /^(\d+)分/)   { $time = $1 * 60; }
  
 
3248 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	elsif ($time =~ /^(\d+)時間/) { $time = $1 * 60 * 60; }
  
 
3249 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	elsif ($time =~ /^(\d+)日/)   { $time = $1 * 60 * 60 * 24; }
  
 
3250 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	else { $self->log("[error] ログイン時刻\"$time\"を解析できませんでした。\n"); }
  
 
3251 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$time = time() - $time;
  
 
3252 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @date = localtime($time);
  
 
3253 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$time = sprintf('%04d/%02d/%02d %02d:%02d', $date[5] + 1900, $date[4] + 1, $date[3], $date[2], $date[1]);
  
 
3254 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $time;
  
 
3255 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3256 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3257 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub test {
  
 
3258 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	$| = 1;
  
 
3259 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $mail = (@_) ? shift : $ENV{'MIXI_MAIL'};
  
 
3260 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $pass = (@_) ? shift : $ENV{'MIXI_PASS'};
  
 
3261 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $log  = (@_) ? shift : "WWW-Mixi-${VERSION}-test.log";
  
 
3262 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3263 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	open(OUT, ">$log");
  
 
3264 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $logger = &test_logger;
  
 
3265 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $error = undef;
  
 
3266 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items = ();
  
 
3267 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 	unless ($mail and  $pass) {
  
 
3268 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		&{$logger}("mixiにログインできるメールアドレスとパスワードを指定してください。\n");
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3269 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		&{$logger}("[usage] perl -MWWW::Mixi -e \"WWW::Mixi::test('mail\@address', 'password');\"\n");
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3270 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		exit 1;
  
 
3271 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3272 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my ($result, $response) = ();
  
 
3273 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# オブジェクトの生成
  
 
3274 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $mixi = &test_new($mail, $pass, $logger);            # オブジェクトの生成
  
 
3275 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$mixi->test_login;                                      # ログイン
  
 
3276 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$mixi->test_get;                                        # GET(トップページ)
  
 
3277 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$mixi->test_scenario;                                   # 主要データの取得と解析
  
 
3278 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$mixi->test_get_add_diary_preview;                      # 日記のプレビュー
  
 
3279 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$mixi->test_save_and_read_cookies;                      # Cookieの読み書き
  
 
3280 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# 終了
  
 
3281 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$mixi->log("終了しました。\n");
  
 
3282 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$mixi->dumper_log({'テストレコード' => $mixi->{'__test_record'}, 'テストリンク' => $mixi->{'__test_link'}});
  
 
3283 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	exit 0;
  
 
3284 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3285 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3286 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub test_logger {
  
 
3287 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	return sub {
  
 
3288 
 
0
 
 
 
 
 
  
0
   
 
 
 
 
 
 		eval "use Jcode";
  
 
3289 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my $use_jcode = ($@) ? 0 : 1;
  
 
3290 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my $self  = shift if (ref($_[0]));
  
 
3291 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @logs  = @_;
  
 
3292 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $error = 0;
  
 
3293 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		foreach my $log (@logs) {
  
 
3294 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			my $log_level = 0;
  
 
3295 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			if    ($log !~ /^(\s|\[.*?\])/) { $log_level = 1; }
  
 
  
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
3296 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			elsif ($log =~ /^\[error\]/)    { $log_level = 1; $error = 1; }
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3297 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			elsif ($log =~ /^\[usage\]/)    { $log_level = 1; }
  
 
3298 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			elsif ($log =~ /^\[warn\]/)     { $log_level = 1; }
  
 
3299 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			elsif ($log =~ /^\[info\]/)     { $log_level = 1; }
  
 
3300 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			elsif ($log =~ /^\s/)           { $log_level = 2; }
  
 
3301 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			else                            { $log_level = 2; }
  
 
3302 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			if ($log_level) { 
  
 
3303 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 				eval '$log = jcode($log, "euc")->sjis' if ($use_jcode);
  
 
3304 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				print OUT $log;
  
 
3305 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 				print $log if ($log_level <= 1);
  
 
3306 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
3307 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
3308 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		return $self;
  
 
3309 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	};
  
 
3310 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3311 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3312 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub test_new {
  
 
3313 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my ($mail, $pass, $logger) = @_;
  
 
3314 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $error = '';
  
 
3315 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	&{$logger}("オブジェクトを生成します。\n");
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3316 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $mixi = eval "WWW::Mixi->new('$mail', '$pass', '-log' => \$logger)";
  
 
3317 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($@) {
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
3318 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$error = "[error] $@\n";
  
 
3319 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} elsif (not $mixi) {
  
 
3320 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$error = "[error] 不明なエラーです。\n";
  
 
3321 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} elsif (not $mixi->{'mixi'}) {
  
 
3322 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$error = "[error] mixi関連情報を設定できませんでした。\n";
  
 
3323 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3324 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($error) {
  
 
3325 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		&{$logger}({}, "オブジェクトを生成できませんでした。\n", $error);
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3326 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		exit 8;
  
 
3327 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3328 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$mixi->delay(0);
  
 
3329 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$mixi->env_proxy;
  
 
3330 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	return $mixi;
  
 
3331 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3332 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3333 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub test_login {
  
 
3334 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $mixi = shift;
  
 
3335 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $error = '';
  
 
3336 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$mixi->log("mixiにログインします。\n");
  
 
3337 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my ($result, $response) = eval '$mixi->login';
  
 
3338 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($@) {
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
3339 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$error = "[error] $@\n";
  
 
3340 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} elsif (not $result) {
  
 
3341 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if (not $response->is_success) {
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
3342 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$error = sprintf("[error] %d %s\n", $response->code, $response->message);
  
 
3343 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			$error .= "[info] Webアクセスにプロキシが必要な時は、環境変数HTTP_PROXYをセットしてから再試行してください。\n" unless($ENV{'HTTP_PROXY'});
  
 
3344 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		} elsif ($mixi->is_login_required($response)) {
  
 
3345 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$error = "[error] " . $mixi->is_login_required($response) . "\n";
  
 
3346 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		} elsif (not $mixi->session) {
  
 
3347 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$error = "[error] セッションIDを取得できませんでした。\n";
  
 
3348 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		} elsif (not $mixi->stamp) {
  
 
3349 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$error = "[error] セッションスタンプを取得できませんでした。\n";
  
 
3350 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		} elsif (not $mixi->session) {
  
 
3351 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$error = "[error] リフレッシュURLを取得できませんでした。\n";
  
 
3352 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
3353 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3354 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($error) {
  
 
3355 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$mixi->log("ログインできませんでした。\n", $error);
  
 
3356 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$mixi->dumper_log($response);
  
 
3357 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		exit 8;
  
 
3358 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} else {
  
 
3359 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$mixi->log('[info] セッションIDは"' . $mixi->session . "\"です。\n");
  
 
3360 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3361 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3362 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3363 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub test_get {
  
 
3364 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $mixi = shift;
  
 
3365 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $error = '';
  
 
3366 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$mixi->log("トップページを取得します。\n");
  
 
3367 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $response = eval '$mixi->get("home")';
  
 
3368 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($@) {
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
3369 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$error = "[error] $@\n";
  
 
3370 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} elsif (not $response->is_success) {
  
 
3371 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$error = sprintf("[error] %d %s\n", $response->code, $response->message);
  
 
3372 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$error .= "[info] Webアクセスにプロキシが必要な時は、環境変数HTTP_PROXYをセットしてから再試行してください。\n" unless($ENV{'HTTP_PROXY'});
  
 
3373 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} elsif ($mixi->is_login_required($response)) {
  
 
3374 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$error = "[error] " . $mixi->is_login_required($response) . "\n";
  
 
3375 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3376 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($error) {
  
 
3377 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$mixi->log("トップページの取得に失敗しました。\n", $error);
  
 
3378 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$mixi->dumper_log($response);
  
 
3379 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		exit 8;
  
 
3380 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3381 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3382 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3383 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub test_record {
  
 
3384 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $mixi = shift;
  
 
3385 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$mixi->{'__test_record'} = {} unless (ref($mixi->{'__test_record'}) eq 'HASH');
  
 
3386 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if (@_ == 0) {
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
3387 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		return sort { $a cmp $b } (keys(%{$mixi->{'__test_record'}}));
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3388 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} elsif (@_ == 1) {
  
 
3389 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $key = shift;
  
 
3390 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		return $mixi->{'__test_record'}->{$key};
  
 
3391 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} else {
  
 
3392 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my %args = @_;
  
 
3393 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		map { $mixi->{'__test_record'}->{$_} = $args{$_} } keys(%args);
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3394 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		return 1;
  
 
3395 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3396 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3397 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3398 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub test_link {
  
 
3399 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $mixi = shift;
  
 
3400 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	$mixi->{'__test_link'} = {} unless (ref($mixi->{'__test_link'}) eq 'HASH');
  
 
3401 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if (@_ == 0) {
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
3402 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		return sort { $a cmp $b } (keys(%{$mixi->{'__test_link'}}));
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3403 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} elsif (@_ == 1) {
  
 
3404 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $key = shift;
  
 
3405 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		return $mixi->{'__test_link'}->{$key};
  
 
3406 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} else {
  
 
3407 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $key = shift;
  
 
3408 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		foreach my $item (grep { ref($_) eq 'HASH' } @_) {
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3409 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			foreach (values(%{$item})) {
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3410 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 				foreach my $value (ref($_) eq 'HASH' ? values(%{$_}) : $_) {
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3411 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 					next if (ref($value) ne '' or $value =~ /\s/);
  
 
3412 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 					next if ($value !~ /^https?:\/\/(?:[^\/]*].)?mixi.jp\/(?:[^\?]*\/)?([^\/\?]+).*$/);
  
 
3413 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 					next if ($mixi->{'__test_link'}->{$1});
  
 
3414 
 
0
 
 
 
 
 
 
 
 
 
 
 
 					$mixi->{'__test_link'}->{$1} = $value;
  
 
3415 
 
 
 
 
 
 
 
 
 
 
 
 
 
 				}
  
 
3416 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
3417 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
3418 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		return 1;
  
 
3419 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3420 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3421 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3422 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub test_scenario {
  
 
3423 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $mixi = shift;
  
 
3424 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	my @tests = (
  
 
3425 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		# 引数不要のもの
  
 
3426 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'main_menu'               => {'label' => 'メインメニュー'},
  
 
3427 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'banner'                  => {'label' => 'バナー'},
  
 
3428 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'tool_bar'                => {'label' => 'ツールバー'},
  
 
3429 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'information'             => {'label' => '管理者からのお知らせ'},
  
 
3430 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'home_new_album'          => {'label' => 'ホームのマイミクシィ最新アルバム'},
  
 
3431 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'home_new_bbs'            => {'label' => 'ホームのコミュニティ最新書き込み'},
  
 
3432 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'home_new_comment'        => {'label' => 'ホームの日記コメント記入履歴'},
  
 
3433 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'home_new_friend_diary'   => {'label' => 'ホームのマイミクシィ最新日記'},
  
 
3434 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'home_new_review'         => {'label' => 'ホームのマイミクシィ最新レビュー'},
  
 
3435 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'list_bookmark'           => {'label' => 'お気に入り'},
  
 
3436 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'list_comment'            => {'label' => '最近のコメント'},
  
 
3437 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'list_community'          => {'label' => 'コミュニティ一覧'},
  
 
3438 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'list_community_next'     => {'label' => 'コミュニティ一覧(次)'},
  
 
3439 
 
0
 
 
 
 
 
  
0
   
 
 
 
 
 
 		'list_community_previous' => {'label' => 'コミュニティ一覧(前)', 'url' => sub { return $_[0]->test_record('list_community_next')}},
  
 
3440 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'list_diary'              => {'label' => '日記'},
  
 
3441 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'list_diary_capacity'     => {'label' => '日記容量'},
  
 
3442 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'list_diary_next'         => {'label' => '日記(次)'},
  
 
3443 
 
0
 
 
 
 
 
  
0
   
 
 
 
 
 
 		'list_diary_previous'     => {'label' => '日記(前)', 'url' => sub { return $_[0]->test_record('list_diary_next')}},
  
 
3444 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'list_diary_monthly_menu' => {'label' => '日記月別ページ'},
  
 
3445 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'list_friend'             => {'label' => '友人・知人一覧'},
  
 
3446 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'list_friend_next'        => {'label' => '友人・知人一覧(次)'},
  
 
3447 
 
0
 
 
 
 
 
  
0
   
 
 
 
 
 
 		'list_friend_previous'    => {'label' => '友人・知人一覧(前)', 'url' => sub { return $_[0]->test_record('list_friend_next')}},
  
 
3448 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'list_message'            => {'label' => '受信メッセージ'},
  
 
3449 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'list_outbox'             => {'label' => '送信メッセージ'},
  
 
3450 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'list_request'            => {'label' => '承認待ちの友人'},
  
 
3451 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'new_album'               => {'label' => 'マイミクシィ最新アルバム'},
  
 
3452 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'new_bbs'                 => {'label' => 'コミュニティ最新書き込み'},
  
 
3453 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'new_bbs_next'            => {'label' => 'コミュニティ最新書き込み(次)'},
  
 
3454 
 
0
 
 
 
 
 
  
0
   
 
 
 
 
 
 		'new_bbs_previous'        => {'label' => 'コミュニティ最新書き込み(前)', 'url' => sub { return $_[0]->test_record('new_bbs_next')}},
  
 
3455 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'new_comment'             => {'label' => '日記コメント記入履歴'},
  
 
3456 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'new_friend_diary'        => {'label' => 'マイミクシィ最新日記'},
  
 
3457 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'new_friend_diary_next'   => {'label' => 'マイミクシィ最新日記(次)'},
  
 
3458 
 
0
 
 
 
 
 
  
0
   
 
 
 
 
 
 		'new_friend_diary_previous' => {'label' => 'マイミクシィ最新日記(前)', 'url' => sub { return $_[0]->test_record('new_friend_diary_next')}},
  
 
3459 
 
0
 
 
 
 
 
  
0
   
 
 
 
 
 
 		'ajax_new_diary'          => {'label' => 'マイミクシィの最新日記(Ajax版)', 'url' => sub { return $_[0]->test_link('ajax_new_diary.pl') }},
  
 
3460 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'new_review'              => {'label' => 'マイミクシィ最新レビュー'},
  
 
3461 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'release_info'            => {'label' => 'リリースインフォメーション'},
  
 
3462 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'self_id'                 => {'label' => '自分のID'},
  
 
3463 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'search_diary'            => {'label' => '新着日記検索', 'arg' => ['keyword' => 'Mixi']},
  
 
3464 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'search_diary_next'       => {'label' => '新着日記検索(次)', 'arg' => ['keyword' => 'Mixi']},
  
 
3465 
 
0
 
 
 
 
 
  
0
   
 
 
 
 
 
 		'search_diary_previous'   => {'label' => '新着日記検索(前)', 'url' => sub { return $_[0]->test_record('search_diary_next')}},
  
 
3466 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'show_calendar'           => {'label' => 'カレンダー'},
  
 
3467 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'show_calendar_term'      => {'label' => 'カレンダーの期間'},
  
 
3468 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'show_calendar_next'      => {'label' => 'カレンダー(次)'},
  
 
3469 
 
0
 
 
 
 
 
  
0
   
 
 
 
 
 
 		'show_calendar_previous'  => {'label' => 'カレンダー(前)', 'url' => sub { return $_[0]->test_record('show_calendar_next')}},
  
 
3470 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'show_intro'              => {'label' => 'マイミクシィからの紹介文'},
  
 
3471 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'show_log'                => {'label' => 'あしあと'},
  
 
3472 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'show_log_count'          => {'label' => 'あしあと数'},
  
 
3473 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		# コンテンツ
  
 
3474 
 
0
 
 
 
 
 
  
0
   
 
 
 
 
 
 		'view_album'              => {'label' => 'フォトアルバム',           'url' => sub { return $_[0]->test_record('new_album')}},
  
 
3475 
 
0
 
  
  0
   
 
 
 
  
0
   
 
 
 
 
 
 		'view_album_photo'        => {'label' => 'フォトアルバムの写真',     'url' => sub { $_ = $_[0]->test_record('new_album'); return ref($_) eq 'HASH' ? $_->{'link'} : undef }},
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3476 
 
0
 
  
  0
   
 
 
 
  
0
   
 
 
 
 
 
 		'view_album_comment'      => {'label' => 'フォトアルバムのコメント', 'url' => sub { $_ = $_[0]->test_record('new_album'); return ref($_) eq 'HASH' ? $_->{'link'} . '&mode=comment' : undef }},
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3477 
 
0
 
 
 
 
 
  
0
   
 
 
 
 
 
 		'view_diary'              => {'label' => '日記(詳細)',               'url' => sub { return $_[0]->test_record('list_diary')}},
  
 
3478 
 
0
 
 
 
 
 
  
0
   
 
 
 
 
 
 		'view_event'              => {'label' => 'イベント',                 'url' => sub { return $_[0]->test_link('view_event.pl')}},
  
 
3479 
 
0
 
 
 
 
 
  
0
   
 
 
 
 
 
 		'view_message'            => {'label' => 'メッセージ(詳細)',         'url' => sub { return $_[0]->test_record('list_message')}},
  
 
3480 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		# コミュニティ関連
  
 
3481 
 
0
 
 
 
 
 
  
0
   
 
 
 
 
 
 		'community_id'            => {'label' => 'コミュニティID',           'url' => sub { return $_[0]->test_record('list_community')}},
  
 
3482 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'list_bbs'                => {'label' => 'トピック一覧',             'arg' => ['id' => 43735]},
  
 
3483 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'list_bbs_next'           => {'label' => 'トピック一覧(次)',         'arg' => ['id' => 43735]},
  
 
3484 
 
0
 
 
 
 
 
  
0
   
 
 
 
 
 
 		'list_bbs_previous'       => {'label' => 'トピック一覧(前)',         'url' => sub { return $_[0]->test_record('list_bbs_next')}},
  
 
3485 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'list_member'             => {'label' => 'メンバー一覧',             'arg' => ['id' => 43735]},
  
 
3486 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'list_member_next'        => {'label' => 'メンバー一覧(次)',         'arg' => ['id' => 43735]},
  
 
3487 
 
0
 
 
 
 
 
  
0
   
 
 
 
 
 
 		'list_member_previous'    => {'label' => 'メンバー一覧(前)',         'url' => sub { return $_[0]->test_record('list_member_next')}},
  
 
3488 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'edit_member'             => {'label' => 'メンバー管理',             'arg' => ['id' => 43735]},
  
 
3489 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'edit_member_pages'       => {'label' => 'メンバー管理(ページ一覧)', 'arg' => ['id' => 43735]},
  
 
3490 
 
0
 
 
 
 
 
  
0
   
 
 
 
 
 
 		'view_bbs'                => {'label' => 'トピック',                 'url' => sub { return $_[0]->test_record('list_bbs')}},
  
 
3491 
 
 
 
 
 
 
 
 
 
 
 
 
 
 #		'view_community'          => {'label' => 'コミュニティ',             'arg' => ['id' => sub { return $_[0]->test_record('community_id')}]},
  
 
3492 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		# 日記の編集
  
 
3493 
 
0
 
 
 
 
 
  
0
   
 
 
 
 
 
 		'edit_diary_preview'      => {'label' => '日記(編集)',       'url' => sub { return $_[0]->test_record('list_diary')}},
  
 
3494 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	);
  
 
3495 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	while (@tests >= 2) {
  
 
3496 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my ($test, $opt) = splice(@tests, 0, 2);
  
 
3497 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $method = "get_$test";
  
 
3498 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my $label  = $opt->{'label'};
  
 
3499 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my $url    = defined($opt->{'url'}) ? $opt->{'url'} : '';
  
 
3500 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if (ref($url) eq 'CODE') {
  
 
3501 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$url   = &{$url}($mixi);
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3502 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			unless ($url) {
  
 
3503 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$mixi->log("$labelをスキップします。\n", "[warn] 参照レコードなし\n");
  
 
3504 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				next;
  
 
3505 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
3506 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
3507 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$url       = $url->{'link'} if (ref($url) eq 'HASH');
  
 
3508 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 		my @arg    = (defined($opt->{'arg'}) and ref($opt->{'arg'})) eq 'ARRAY' ? @{$opt->{'arg'}} : ();
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3509 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		@arg       = map { ref($_) eq 'CODE' ? &{$_}($mixi) : $_ } @arg;
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3510 
 
0
 
  
  0
   
 
  
  0
   
 
 
 
 
 
 
 
 		unshift(@arg, $url) if (defined($url) and ref($url) eq '' and length($url));
  
 
  
 
 
 
 
 
  
  0
   
 
 
 
 
 
 
 
    
 
3511 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$mixi->log("$labelの取得と解析($method)をします。\n");
  
 
3512 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$mixi->log(qq([info] ターゲットURLは"$url"です。\n)) if ($url);
  
 
3513 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		my @items  = eval { $mixi->$method(@arg); };
  
 
  
 
0
 
 
 
 
 
 
 
 
 
 
 
    
 
3514 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		my $error  = ($@) ? $@ : ($mixi->response->is_error) ? $mixi->response->status_line : undef;
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
3515 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if (defined $error) {
  
 
3516 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$mixi->log("$labelの取得と解析に失敗しました。\n", "[error] $error\n");
  
 
3517 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$mixi->dumper_log($mixi->response);
  
 
3518 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			exit 8;
  
 
3519 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		} else {
  
 
3520 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 			if (@items) {
  
 
3521 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$mixi->dumper_log([@items]);
  
 
3522 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$mixi->test_link($test => @items);
  
 
3523 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$mixi->test_record($test => $items[0]);
  
 
3524 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 				$mixi->test_record($test => {'link' => 'http://mixi.jp/view_album.pl?id=150828'}) if ($test eq 'new_album');
  
 
3525 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			} else {
  
 
3526 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$mixi->log("[warn] レコードが見つかりませんでした。\n");
  
 
3527 
 
0
 
 
 
 
 
 
 
 
 
 
 
 				$mixi->dumper_log($mixi->response);
  
 
3528 
 
 
 
 
 
 
 
 
 
 
 
 
 
 			}
  
 
3529 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
3530 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3531 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3532 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3533 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub test_get_add_diary_preview {
  
 
3534 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $mixi = shift;
  
 
3535 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my %diary = (
  
 
3536 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'diary_title' => '日記タイトル',
  
 
3537 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'diary_body'  => '日記本文',
  
 
3538 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'photo1'      => '../logo.jpg',
  
 
3539 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		'orig_size'   => 1,
  
 
3540 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	);
  
 
3541 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$mixi->log("日記の投稿と確認画面の解析をします。\n");
  
 
3542 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my @items = eval '$mixi->get_add_diary_preview(%diary)';
  
 
3543 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	my $error = ($@) ? "[error] $@\n" : ($mixi->response->is_error) ? "[error] " . $mixi->response->status_line ."\n" : '';
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
3544 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($error) {
  
 
3545 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$mixi->log("日記の投稿と確認画面の解析に失敗しました。\n", $error);
  
 
3546 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		exit 8;
  
 
3547 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} else {
  
 
3548 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		if (@items) {
  
 
3549 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$mixi->dumper_log([@items]);
  
 
3550 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		} else {
  
 
3551 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$mixi->log("[info] 確認画面のフォームが見つかりませんでした。\n");
  
 
3552 
 
0
 
 
 
 
 
 
 
 
 
 
 
 			$mixi->dumper_log($mixi->response);
  
 
3553 
 
 
 
 
 
 
 
 
 
 
 
 
 
 		}
  
 
3554 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3555 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3556 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3557 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub test_save_and_read_cookies {
  
 
3558 
 
0
 
 
 
 
 
  
0
   
 
  
0
   
 
 
 
 	my $mixi = shift;
  
 
3559 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $error = '';
  
 
3560 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# Cookieの保存
  
 
3561 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$mixi->log("Cookieを保存します。\n");
  
 
3562 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $saved_str   = $mixi->cookie_jar->as_string;
  
 
3563 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $loaded_str  = '';
  
 
3564 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	my $cookie_file = sprintf('cookie_%s_%s.txt', $$, time);
  
 
3565 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$_ = eval '$mixi->save_cookies($cookie_file)';
  
 
3566 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($@) {
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
3567 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$error = "[error] $@\n";
  
 
3568 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} elsif (not $_) {
  
 
3569 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$error = "[error] cookieの保存が失敗しました。\n";
  
 
3570 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3571 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($error) {
  
 
3572 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$mixi->log("Cookieを保存できませんでした。\n", $error);
  
 
3573 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		exit 8;
  
 
3574 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3575 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	# Cookieの読込
  
 
3576 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$mixi->log("Cookieの読込をします。\n");
  
 
3577 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$mixi->cookie_jar->clear;
  
 
3578 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	$_ = eval '$mixi->load_cookies($cookie_file)';
  
 
3579 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($@) {
  
 
  
 
 
 
  
  0
   
 
 
 
 
 
 
 
 
 
    
 
3580 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$error = "[error] $@\n";
  
 
3581 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} elsif (not $_) {
  
 
3582 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$error = "[error] cookieの読込が失敗しました。\n";
  
 
3583 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	} else {
  
 
3584 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$loaded_str = $mixi->cookie_jar->as_string;
  
 
3585 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 		$error = "[error] 保存したCookieと読み込んだCookieが一致しません。\n" if ($saved_str ne $loaded_str);
  
 
3586 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3587 
 
0
 
  
  0
   
 
 
 
 
 
 
 
 
 
 	if ($error) {
  
 
3588 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		$mixi->log("Cookieを読込めませんでした。\n", $error);
  
 
3589 
 
0
 
 
 
 
 
 
 
 
 
 
 
 		exit 8;
  
 
3590 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	}
  
 
3591 
 
0
 
 
 
 
 
 
 
 
 
 
 
 	unlink($cookie_file);
  
 
3592 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3593 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3594 
 
 
 
 
 
 
 
 
 
 
 
 
 
 package WWW::Mixi::RobotRules;
  
 
3595 
 
1
 
 
 
 
 
  
1
   
 
 
 
15
 
 use vars qw($VERSION @ISA);
  
 
  
 
1
 
 
 
 
 
 
 
 
 
3
 
    
 
  
 
1
 
 
 
 
 
 
 
 
 
194
 
    
 
3596 
 
 
 
 
 
 
 
 
 
 
 
 
 
 require WWW::RobotRules;
  
 
3597 
 
 
 
 
 
 
 
 
 
 
 
 
 
 @ISA = qw(WWW::RobotRules::InCore);
  
 
3598 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3599 
 
 
 
 
 
 
 
 
 
 
 
 
 
 $VERSION = sprintf("%d.%02d", q$Revision: 0.01 $ =~ /(\d+)\.(\d+)/);
  
 
3600 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3601 
 
 
 
 
 
 
 
 
 
 
 
 
 
 sub allowed {
  
 
3602 
 
0
 
 
 
 
 
  
0
   
 
 
 
 
 
 	return 1;
  
 
3603 
 
 
 
 
 
 
 
 
 
 
 
 
 
 }
  
 
3604 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3605 
 
 
 
 
 
 
 
 
 
 
 
 
 
 1;
  
 
3606 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3607 
 
 
 
 
 
 
 
 
 
 
 
 
 
 =head1 NAME
  
 
3608 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3609 
 
 
 
 
 
 
 
 
 
 
 
 
 
 WWW::Mixi - Perl extension for scraping the MIXI social networking service.
  
 
3610 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3611 
 
 
 
 
 
 
 
 
 
 
 
 
 
 =head1 SYNOPSIS
  
 
3612 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3613 
 
 
 
 
 
 
 
 
 
 
 
 
 
   require WWW::Mixi;
  
 
3614 
 
 
 
 
 
 
 
 
 
 
 
 
 
   $mixi = WWW::Mixi->new('me@foo.com', 'password');
  
 
3615 
 
 
 
 
 
 
 
 
 
 
 
 
 
   $mixi->login;
  
 
3616 
 
 
 
 
 
 
 
 
 
 
 
 
 
   my $res = $mixi->get('home.pl');
  
 
3617 
 
 
 
 
 
 
 
 
 
 
 
 
 
   print $res->content;
  
 
3618 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3619 
 
 
 
 
 
 
 
 
 
 
 
 
 
 =head1 DESCRIPTION
  
 
3620 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3621 
 
 
 
 
 
 
 
 
 
 
 
 
 
 WWW::Mixi uses LWP::RobotUA to scrape mixi.jp.
  
 
3622 
 
 
 
 
 
 
 
 
 
 
 
 
 
 This provide login method, get and put method, and some parsing method for user who create mixi spider.
  
 
3623 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3624 
 
 
 
 
 
 
 
 
 
 
 
 
 
 I think using WWW::Mixi is better than using LWP::UserAgent or LWP::Simple for accessing Mixi.
  
 
3625 
 
 
 
 
 
 
 
 
 
 
 
 
 
 WWW::Mixi automatically enables cookie, take delay 1 second for each access, take care robot exclusions.
  
 
3626 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3627 
 
 
 
 
 
 
 
 
 
 
 
 
 
 See "mixi.pod" for more detail.
  
 
3628 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3629 
 
 
 
 
 
 
 
 
 
 
 
 
 
 =head1 SEE ALSO
  
 
3630 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3631 
 
 
 
 
 
 
 
 
 
 
 
 
 
 L, L, L
     
 
3632 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3633 
 
 
 
 
 
 
 
 
 
 
 
 
 
 =head1 AUTHORS
  
 
3634 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3635 
 
 
 
 
 
 
 
 
 
 
 
 
 
 WWW::Mixi is written by TSUKAMOTO Makio 
   
 
3636 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3637 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Some bug fixes submitted by Topia (http://clovery.jp/), shino (http://www.freedomcat.com/), makamaka (http://www.donzoko.net/), ash.
  
 
3638 
 
 
 
 
 
 
 
 
 
 
 
 
 
 get_ and post_add_diary, get_ and post_delete_diary, parse_list_diary and parse_new_diary contributed by DonaDona (http://hsj.jp/).
  
 
3639 
 
 
 
 
 
 
 
 
 
 
 
 
 
 get_ and parse_view_diary contributed by shino (http://www.freedomcat.com/).
  
 
3640 
 
 
 
 
 
 
 
 
 
 
 
 
 
 get_ and parse_list_outbox contributed by AsO (http://www.bx.sakura.ne.jp/~clan/rn/cgi-bin/index.cgi).
  
 
3641 
 
 
 
 
 
 
 
 
 
 
 
 
 
 get_ and post_send_message contributed by noname (http://untitled.rootkit.jp/diary/).
  
 
3642 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3643 
 
 
 
 
 
 
 
 
 
 
 
 
 
 =head1 COPYRIGHT
  
 
3644 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3645 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Copyright 2004-2006 Makio Tsukamoto.
  
 
3646 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
3647 
 
 
 
 
 
 
 
 
 
 
 
 
 
 This library is free software; you can redistribute it and/or
  
 
3648 
 
 
 
 
 
 
 
 
 
 
 
 
 
 modify it under the same terms as Perl itself.
  
 
3649