Created
June 3, 2015 03:50
-
-
Save yappo/4ae5c7289472ef9a38b6 to your computer and use it in GitHub Desktop.
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
use strict; | |
use warnings; | |
use Furl; | |
my $furl = Furl->new( agent => 'Moznion/1.0' ); | |
my $wait = 3; | |
my %last_vote_counts; | |
while (1) { | |
my $res = $furl->get('http://doraperson2015.yapcasia.org/'); | |
my $data = $res->content; | |
my %current; | |
my %vote_counts; | |
while ($data =~ m{<dl>.+?<a href="(.+?)">.+?<em>(\d+)</em>}gsm) { | |
my($path, $count) = ($1, $2); | |
$current{$path} = $count - ($last_vote_counts{$path} // 0); | |
$vote_counts{$path} = $2; | |
} | |
%last_vote_counts = %vote_counts; | |
for my $path (sort { $current{$b} <=> $current{$a} } keys %current) { | |
printf "%12d/QPS http://doraperson2015.yapcasia.org%s\n", int($current{$path} / $wait), $path; | |
} | |
print "\n\n-------------------------------------------------\n\n"; | |
sleep $wait; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@yappo test
@tokuhirom test