Changeset 2122

Show
Ignore:
Timestamp:
11/28/07 19:04:38 (5 years ago)
Author:
yasu
Message:

lang/perl/WWW-NicoVideo?:

げえっ ニコ動仕変!

  • linkに http://www.nicovideo.jp/ が二重に含まれてしまったのを修正
  • 再生時間/再生数/コメント数が空になっていたのを修正
Location:
lang/perl/WWW-NicoVideo/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/WWW-NicoVideo/trunk/examples/ritsuko.pl

    r2008 r2122  
    22 
    33# WWW::NicoVideo example 
    4 # usage: perl -Ilib examples/ritsuko.pl ritsuko@ritsuko.org your-password 
     4# usage: perl -Ilib examples/ritsuko.pl your-mail@ritsuko.org your-password 
    55 
    66use utf8; 
  • lang/perl/WWW-NicoVideo/trunk/lib/WWW/NicoVideo/Scraper.pm

    r2008 r2122  
    3232                      imgWidth => '@width', 
    3333                      imgHeight =>  '@height'); 
    34               process('/div/div/p[2]/strong', 
     34              process('/div/div/p/strong', 
    3535                      lengthStr => 'TEXT', 
    3636                      length => sub { shift->as_text =~ /(?:(\d+)分)?(\d+)秒/; 
    3737                                      $1*60 + $2 }); 
    38               process('/div/div/p[2]/strong[2]', 
     38              process('/div/div/p/strong[2]', 
    3939                      numViewsStr => 'TEXT', 
    4040                      numViews => sub { my $x = shift->as_text; 
    4141                                        $x =~ tr/,//d; 
    4242                                        $x }); 
    43               process('/div/div/p[2]/strong[3]', 
     43              process('/div/div/p/strong[3]', 
    4444                      numCommentsStr => 'TEXT', 
    4545                      numComments => sub { my $x = shift->as_text; 
     
    4949                      title => 'TEXT', 
    5050                      id => sub { shift->attr("href") =~ /(\w+)$/; $1 }, 
    51                       url => sub { nicoURL("base") . shift->attr("href") }); 
     51                      url => '@href'); 
    5252              process('/div/div[2]/p', 
    5353                      desc => sub { shift->content_array_ref->[-1] =~ /\s*(.*)/; 
    5454                                    $1 }), 
    55                                     process('/div/div[2]/div/p/strong', 
    56                                             comments => 'TEXT'); 
     55              process('/div/div[2]/div/p/strong', 
     56                      comments => sub { my $x = shift->as_text; 
     57                                        $x =~ s/\s+$//; 
     58                                        $x; }); 
    5759            }); 
    5860  };