Changeset 1922 for lang/perl/WWW-CommentGetter/trunk
- Timestamp:
- 11/23/07 13:26:24 (6 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/WWW-CommentGetter/trunk/WWW-CommentGetter/lib/WWW/CommentGetter/Plugin/HatenaDiary.pm
r662 r1922 11 11 return unless $url =~ m{^http://d.hatena.ne.jp.*}; 12 12 13 # tokuhirom \x{300e}\x{305d}\x{3093}\x{306a}\x{3082}\x{3093}\x{304b}\x{306d}\x{3002}\x{300f} (2007/10/22 07:29)14 15 13 my $ret = scraper { 16 process 'div.commentshort > p', 'bodies[]' => sub { 17 my $elem = shift; 18 if ($elem->as_text =~ m{^(.+) \x{300e}(.+)\x{300f} \((\d{4}/\d\d/\d\d \d\d:\d\d)\)$}) { 19 return +{ author => $self->trim($1), body => $2, date => $3 }; 20 } else { 21 return; 22 } 14 process '//div[@class="commentshort"]/p[@class!="commentmessage"]', 'comments[]' => scraper { 15 process '//span[@class="commentator"]', 'author', 'TEXT'; 16 process '//span[@class="commentbody"]', 'body', 'TEXT'; 17 process '//span[@class="timestamp"]', 'date', 'TEXT'; 23 18 }; 24 19 }->scrape(URI->new($url)); 25 20 26 return [ 27 grep { $_ } @{ $ret->{bodies} } 28 ]; 21 return [ @{ $ret->{comments} } ]; 29 22 } 30 23
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)