#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; use WebService::Hatena::Graph; use DateTime; my $gamertag = ''; my $hatena_id = ''; my $hatena_password = ''; my $hatena_graphname = '実績'; my $ua = LWP::UserAgent->new; my $response = $ua->get("http://gamercard.xbox.com/$gamertag.card"); if ($response->is_success) { if ($response->content =~ m!(\d+)!) { my $score = $1; my $graph = WebService::Hatena::Graph->new(username => $hatena_id, password => $hatena_password); $graph->post_data( graphname => $hatena_graphname, date => DateTime->now->strftime('%Y-%m-%d'), value => $score, ); print "Posted: $score pts.\n"; } else { die "Scraping failed."; } } else { die "Fetching http://gamercard.xbox.com/$gamertag.card failed."; }