Changeset 2189 for lang/perl/WWW-NicoVideo
- Timestamp:
- 12/01/07 01:12:05 (14 months ago)
- Location:
- lang/perl/WWW-NicoVideo/trunk
- Files:
-
- 3 modified
-
README (modified) (1 diff)
-
lib/WWW/NicoVideo.pm (modified) (1 diff)
-
lib/WWW/NicoVideo/Scraper.pm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/WWW-NicoVideo/trunk/README
r2028 r2189 1 WWW-NicoVideo version 0.0 31 WWW-NicoVideo version 0.04 2 2 ========================== 3 3 -
lang/perl/WWW-NicoVideo/trunk/lib/WWW/NicoVideo.pm
r2147 r2189 19 19 __PACKAGE__->mk_accessors(qw[agent retry retryInterval mail passwd]); 20 20 21 our $VERSION = "0.0 3";21 our $VERSION = "0.04"; 22 22 our $AGENT_NAME = "@{[__PACKAGE__]}/$VERSION)"; 23 23 -
lang/perl/WWW-NicoVideo/trunk/lib/WWW/NicoVideo/Scraper.pm
r2122 r2189 9 9 use WWW::NicoVideo::URL; 10 10 use base qw[Web::Scraper]; 11 11 use Time::Local; 12 12 sub import 13 13 { … … 17 17 no strict "refs"; 18 18 *{"$pkg\::scraper_entries"} = \&scraper_entries; 19 *{"$pkg\::scraper_entry"} = \&scraper_entry; 19 20 *{"$pkg\::scraper"} = \&scraper; 20 21 *{"$pkg\::process"} = sub { goto &process }; … … 51 52 url => '@href'); 52 53 process('/div/div[2]/p', 53 desc => sub { shift->content_array_ref->[-1] =~ /\s*(.*)/; 54 $1 }), 54 desc => sub { shift->as_trimmed_text }), 55 55 process('/div/div[2]/div/p/strong', 56 56 comments => sub { my $x = shift->as_text; … … 61 61 } 62 62 63 sub scraper_entry() 64 { 65 scraper { 66 process('//h1', 67 title => 'TEXT'); 68 process('//div[@id="PAGEBODY"]/div/div/p/img', 69 imgUrl => '@src', 70 imgWidth => '@width', 71 imgHeight => '@height'); 72 my $postDateTimeStr; 73 process('//div[@id="PAGEBODY"]/div/div/p[2]/strong', 74 postDateTimeStr => sub { 75 $postDateTimeStr = shift->content_array_ref->[-1]; 76 $postDateTimeStr =~ tr/:/:/; 77 $postDateTimeStr }, 78 postDateTime => sub { 79 $postDateTimeStr =~ 80 /(\d+)年(\d+)月(\d+)日\s+(\d+)\D+(\d+)\D+(\d+)/; 81 timelocal($6, $5, $4, $3, $2, $1); } 82 ); 83 process('//div[@id="PAGEBODY"]/div/div/p[3]', 84 fullDesc => 'TEXT'); 85 process('//div[@id="PAGEBODY"]/div/div[2]/p', 86 tags => sub { [split /\xA0+/, shift->content_array_ref->[-1]] }); 87 }; 88 89 } 90 63 91 "Ritsuko";
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)