Changeset 1768

Show
Ignore:
Timestamp:
10/16/06 15:16:42
Author:
miyagawa
Message:

Filter::HatenaBookmarkUsersCount?: splice by 50 links. via http://subtech.g.hatena.ne.jp/otsune/20061016/HatenaBookmarkAPIfix

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/Filter/HatenaBookmarkUsersCount.pm

    r189 r1768  
    1818    my @permalink = map $_->permalink, $args->{feed}->entries; 
    1919 
    20     $context->log(info => 'Requesting XMLRPC call to Hatena Bookmark with ' . scalar(@permalink) . ' link(s)'); 
     20    while (my @links = splice(@permalink, 0, 50)) { 
     21        $context->log(info => 'Requesting XMLRPC call to Hatena Bookmark with ' . scalar(@links) . ' link(s)'); 
    2122 
    22     my $map = XMLRPC::Lite 
    23         ->proxy('http://b.hatena.ne.jp/xmlrpc') 
    24         ->call('bookmark.getCount', @permalink
    25         ->result; 
     23        my $map = XMLRPC::Lite 
     24            ->proxy('http://b.hatena.ne.jp/xmlrpc') 
     25            ->call('bookmark.getCount', @links
     26            ->result; 
    2627 
    27     unless ($map) { 
    28         $context->log(warn => 'Hatena Bookmark XMLRPC failed'); 
    29         return; 
    30    
     28        unless ($map) { 
     29            $context->log(warn => 'Hatena Bookmark XMLRPC failed'); 
     30            return; 
     31       
    3132 
    32     $context->log(info => 'XMLRPC request success.'); 
     33        $context->log(info => 'XMLRPC request success.'); 
    3334 
    34     for my $entry ($args->{feed}->entries) { 
    35         if (defined(my $count = $map->{$entry->permalink})) { 
    36             $entry->meta->{hatenabookmark_users} = $count; 
     35        for my $entry ($args->{feed}->entries) { 
     36            if (defined(my $count = $map->{$entry->permalink})) { 
     37                $entry->meta->{hatenabookmark_users} = $count; 
     38            } 
    3739        } 
    3840    }