Changeset 3147 for lang/perl/plagger
- Timestamp:
- 12/14/07 23:09:50 (12 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/plagger/lib/Plagger/Plugin/Filter/FetchNicoVideo.pm
r1105 r3147 8 8 use File::Spec; 9 9 use HTTP::Request; 10 use Time::HiRes qw(sleep); 10 11 use Plagger::Enclosure; 11 12 use Plagger::UserAgent; … … 75 76 my $path = File::Spec->catfile( $self->conf->{dir}, $filename . ".flv" ); 76 77 77 #access video page 78 $ua->get("http://www.nicovideo.jp/watch/$video_id"); 78 unless ( -e $path ) { 79 #access video page 80 $ua->get("http://www.nicovideo.jp/watch/$video_id"); 79 81 80 #download flv file 81 unless ( -e $path ) { 82 my $req = HTTP::Request->new(GET => $enclosure->url); 83 $context->log(info => "Fetching $video_id FLV File from " . $enclosure->url . "..." ); 84 my $res = $ua->request($req, $path); 85 $context->log(warn => "Fetch FLV Error: $video_id" ) if $res->is_error; 82 #download flv file 83 my $req = HTTP::Request->new(GET => $enclosure->url); 84 $context->log(info => "Fetching $video_id FLV File from " . $enclosure->url . "..." ); 85 my $res = $ua->request($req, $path); 86 $context->log(warn => "Fetch FLV Error: $video_id" ) if $res->is_error; 87 }else{ 88 $context->log(info => "Exist FLV File: $video_id"); 89 my $sleeping_time = $self->conf->{interval} || 15; 90 $context->log(info => "sleep $sleeping_time."); 91 sleep( $sleeping_time ); 86 92 } 87 93 … … 108 114 } 109 115 $entry->add_enclosure($enclosure); 110 111 sleep(1);112 116 } 113 117 … … 129 133 download_xml: 1 #optional default is 0 130 134 filename_encode: euc-jp #optional default is utf-8 135 interval: 60 #optional default is 15 131 136 132 137 =head1 DESCRIPTION
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)