2 use 5.010; use strict; use warnings;
8 if (m{<td class=hl>} .. m{</?td>}) {
9 $count{-source} = 'http://stats.wikimedia.org/archive/squid_reports/';
10 $count{-title } = 'Wikimedia';
11 $count{-date} = $1 if m{ period: (?:\d+ )?(\w+ \d+) };
15 # select relevant columns
16 />Browser versions(.*)/ ... m{</table>} && last or next;
17 my ($tr, $id, $count2, $count) = split /(?:<[^>]*>)+/;
18 $mobile = $count2 !~ /non mobile/ if $id ~~ ' ';
19 next if $id ~~ ['Total', ' '];
21 # convert to usable syntax
22 my ($browser, $version) = split /\h+/, $id, 2;
27 when (['Firefox', 'Iceweasel']) {
28 $browser = $mobile ? 'and_ff' : 'firefox';
32 $browser = $mobile ? 'ie_mob' : 'ie';
36 $browser = $mobile ? 'op_mob' : 'opera';
38 if (m{\(Mini(.*)\)$}) {
40 ($_) = $1 =~ m{^/(\d+)};
43 s/^\d*\.\d\K.*//; # one significant digit
48 $browser = $mobile ? 'ios_saf' : 'safari';
49 my $numversion = join('.', map { sprintf '%03d', $_ } split /\./, $version);
50 $numversion =~ s/6(?=\d{3})//; # incomparable 6532.22 → 523
52 # http://en.wikipedia.org/wiki/Safari_version_history
65 [ '525.013' => '3.1' ],
66 [ '525.026' => '3.2' ],
72 last if $numversion lt $_->[0];
77 $browser = $mobile ? 'and_chr' : 'chrome';
78 s/\.\d+$// for $version;
89 s/\.0$// for $version;
92 $count{$browser}{$version} += $count;
103 curl http://stats.wikimedia.org/archive/squid_reports/2010-10/SquidReportClients.htm |
104 ./mkusage-wikimedia > browser-usage.inc.pl