nicoscience.pl

# http://nicoscience.blog50.fc2.com/
sub init {
    my $self = shift;
    $self->{domain} = "nicoscience.blog50.fc2.com";
    $self->{handle} = ".";
}
 
sub needs_content { 1 }
 
sub find {
    my ($self, $args) = @_;
    my($id) = $args->{content} =~ m!\/watch\/(\w+)!
        or return;
 
    my $enclosure = Plagger::Enclosure->new;
    $enclosure->url("http://ext.nicovideo.jp/thumb_watch/$id");
    $enclosure->type('application/javascript');
    $enclosure->thumbnail({ url => $self->_thumbnail_for($id) });
    return $enclosure;
}
 
sub _thumbnail_for {
    my($self, $id) = @_;
 
    if (0) {
    my $res = Plagger::UserAgent->new->fetch("http://www.nicovideo.jp/api/getthumbinfo/$id");
 
    unless ($res->is_error) {
        my $doc = XML::LibXML->new->parse_string($res->content);
 
        my @nodes = $doc->findnodes('//thumbnail_url');
        if (@nodes) {
            return $nodes[0]->textContent;
        }
    }
    }
 
    $id =~ s!^\w\w!!;
    return "http://tn-skr1.smilevideo.jp/smile?i=$id";
}
 

タグ:

+ タグ編集
  • タグ:

このサイトはreCAPTCHAによって保護されており、Googleの プライバシーポリシー利用規約 が適用されます。

最終更新:2009年01月17日 21:50
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。