WWW::Mixi::Scraper::Plugin::ListComment - WWW::Mixi::Scraper::Plugin::ListComment documentation


WWW-Mixi-Scraper documentation Contained in the WWW-Mixi-Scraper distribution.

Index


Code Index:

NAME

Top

WWW::Mixi::Scraper::Plugin::ListComment

DESCRIPTION

Top

This is equivalent to WWW::Mixi->parse_list_comment().

METHOD

Top

scrape

returns an array reference of

  {
    subject => 'comment extract',
    name    => 'someone',
    link    => 'http://mixi.jp/view_diary.pl?id=xxxx',
    time    => 'yyyy-mm-dd hh:mm'
  }

AUTHOR

Top

Kenichi Ishigaki, <ishigaki at cpan.org>

COPYRIGHT AND LICENSE

Top


WWW-Mixi-Scraper documentation Contained in the WWW-Mixi-Scraper distribution.

package WWW::Mixi::Scraper::Plugin::ListComment;

use strict;
use warnings;
use WWW::Mixi::Scraper::Plugin;

validator {qw( id is_number )};

sub scrape {
  my ($self, $html) = @_;

  my %scraper;
  $scraper{comments} = scraper {
    process 'dl>dd',
      string => 'TEXT';
    process 'dl>dd>a',
      link => '@href',
      subject => 'TEXT';
    process 'dl>dt',
      time => 'TEXT';
    result qw( string time link subject );
  };

  $scraper{list} = scraper {
    process 'div.listCommentArea>ul.entryList01>li',
      'comments[]' => $scraper{comments};
    result qw( comments );
  };

  return $self->post_process(
    $scraper{list}->scrape(\$html) => \&_extract_name
  );
}

1;

__END__