Changeset 2122 for lang/perl/WWW-NicoVideo
- Timestamp:
- 11/28/07 19:04:38 (14 months ago)
- Location:
- lang/perl/WWW-NicoVideo/trunk
- Files:
-
- 2 modified
-
examples/ritsuko.pl (modified) (1 diff)
-
lib/WWW/NicoVideo/Scraper.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/WWW-NicoVideo/trunk/examples/ritsuko.pl
r2008 r2122 2 2 3 3 # WWW::NicoVideo example 4 # usage: perl -Ilib examples/ritsuko.pl ritsuko@ritsuko.org your-password4 # usage: perl -Ilib examples/ritsuko.pl your-mail@ritsuko.org your-password 5 5 6 6 use utf8; -
lang/perl/WWW-NicoVideo/trunk/lib/WWW/NicoVideo/Scraper.pm
r2008 r2122 32 32 imgWidth => '@width', 33 33 imgHeight => '@height'); 34 process('/div/div/p [2]/strong',34 process('/div/div/p/strong', 35 35 lengthStr => 'TEXT', 36 36 length => sub { shift->as_text =~ /(?:(\d+)分)?(\d+)秒/; 37 37 $1*60 + $2 }); 38 process('/div/div/p [2]/strong[2]',38 process('/div/div/p/strong[2]', 39 39 numViewsStr => 'TEXT', 40 40 numViews => sub { my $x = shift->as_text; 41 41 $x =~ tr/,//d; 42 42 $x }); 43 process('/div/div/p [2]/strong[3]',43 process('/div/div/p/strong[3]', 44 44 numCommentsStr => 'TEXT', 45 45 numComments => sub { my $x = shift->as_text; … … 49 49 title => 'TEXT', 50 50 id => sub { shift->attr("href") =~ /(\w+)$/; $1 }, 51 url => sub { nicoURL("base") . shift->attr("href") });51 url => '@href'); 52 52 process('/div/div[2]/p', 53 53 desc => sub { shift->content_array_ref->[-1] =~ /\s*(.*)/; 54 54 $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; }); 57 59 }); 58 60 };
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)