git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
keyboard: match transliterated letters
[sheet.git]
/
tools
/
mkusage-wikimedia
diff --git
a/tools/mkusage-wikimedia
b/tools/mkusage-wikimedia
index 5e264ed295ed0bba44b22ddd616a1a6d304a68f6..a4ca1cd1c38048367e48f8474a30e65769710e59 100755
(executable)
--- a/
tools/mkusage-wikimedia
+++ b/
tools/mkusage-wikimedia
@@
-9,8
+9,8
@@
our $VERSION = '1.00';
my %BROWSERID = qw(
IE ie
IE-Mobile ie_mob
my %BROWSERID = qw(
IE ie
IE-Mobile ie_mob
- Edge
edg
e
- Edge-Mobile
edg
e
+ Edge
i
e
+ Edge-Mobile
i
e
Firefox firefox
Firefox-Mobile and_ff
Safari safari
Firefox firefox
Firefox-Mobile and_ff
Safari safari
@@
-18,8
+18,8
@@
my %BROWSERID = qw(
Mobile-Safari-UIWebView ios_saf
Chrome chrome
Chromium chrome
Mobile-Safari-UIWebView ios_saf
Chrome chrome
Chromium chrome
- Chrome-Mobile and
_chr
- Chrome-Mobile-iOS and
_chr
+ Chrome-Mobile and
roid
+ Chrome-Mobile-iOS and
roid
Android android
Opera opera
Opera-Mini op_mini
Android android
Opera opera
Opera-Mini op_mini
@@
-32,7
+32,7
@@
my %count = (
-site => 'https://analytics.wikimedia.org/',
);
-site => 'https://analytics.wikimedia.org/',
);
-my $recent = qr/^201
7
-/;
+my $recent = qr/^201
8
-/;
(readline =~ y/\t//) == 3 or die "unexpected amount of columns in header\n";
(readline =~ y/\t//) == 3 or die "unexpected amount of columns in header\n";
@@
-41,13
+41,12
@@
while (my $row = readline) {
$date =~ $recent or next;
$name =~ y/ /-/;
my $browser = $BROWSERID{$name} or next;
$date =~ $recent or next;
$name =~ y/ /-/;
my $browser = $BROWSERID{$name} or next;
+ $version =~ s/\A-\z/0/;
$count{$browser}{$version} += $pct;
$count{-total} += $pct;
$count{$browser}{$version} += $pct;
$count{-total} += $pct;
- $count{-date}
->{$date}++
;
+ $count{-date}
= $date
;
}
}
-$_ = join ' to ', (sort keys %{$_})[0, -1] for $count{-date};
-
my $mult = 100 / delete $count{-total};
for (values %count) {
ref $_ eq 'HASH' or next;
my $mult = 100 / delete $count{-total};
for (values %count) {
ref $_ eq 'HASH' or next;
@@
-60,6
+59,5
@@
__END__
=head1 USAGE
=head1 USAGE
- curl https://analytics.wikimedia.org/datasets/periodic/reports/metrics/browser/all_sites_by_browser_family_and_major_percent.tsv |
- ./mkusage-wikimedia >browser-usage.inc.pl
+ ./mkusage-wikimedia wikipedia-analytics.tsv >browser-usage.inc.pl