Created
March 2, 2009 22:37
-
-
Save kga/73033 to your computer and use it in GitHub Desktop.
ldr2graph
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Config::Pit qw/pit_get/; | |
use LWP::Simple qw//; | |
use List::Util qw/sum/; | |
use WebService::Hatena::Graph; | |
my $hatena_id = 'KGA'; | |
my $ldr_api = 'http://rpc.reader.livedoor.com/count?feedlink='; | |
my @feeds = map { "http://d.hatena.ne.jp/$hatena_id/$_" } qw/rss rss2/; | |
my $conf = pit_get('hatena.ne.jp', require => { | |
username => 'Hatena ID', | |
password => 'Password', | |
}); | |
my $graph = WebService::Hatena::Graph->new(%$conf); | |
my $total = sum map { LWP::Simple::get("$ldr_api$_") } @feeds; | |
$graph->post_data( | |
graphname => "LDR$hatena_id", | |
value => $total, | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment