blob: 496293066c6508f22335da0ce29a213aaf9bdc17 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#!/usr/bin/perl
use warnings;
use strict;
use JSON;
use WWW::Mechanize;
use Data::Dumper;
my $m = WWW::Mechanize->new();
#$m->get("https://archlinux.org/mirrors/status/tier/1/json");
$m->get("https://archlinux.org/mirrors/status/json");
my $mirrors = decode_json($m->content());
my %countries = ();
for my $mirror (@{$mirrors->{urls}}) {
$countries{$mirror->{country_code}}++;
}
my @sorted_countries = sort {$countries{$a} <=> $countries{$b}} keys %countries;
for my $key (@sorted_countries) {
my $value = $countries{$key};
print "$key: $value\n";
}
|