9 if (m{<td class=hl>} .. m{</?td>}) {
10 $count{-source} = 'http://stats.wikimedia.org/archive/squid_reports/';
11 $count{-title } = 'Wikimedia';
12 $count{-date} = $1 if m{ period: (?:\d+ )?(\w+ \d+) };
16 # select relevant data
17 />In alphabetical order/ .. eof or next; # second table
18 my ($id, $count2, $count) = map { s/<[^>]*>//gr } split /<\/td>/;
21 />Browser versions(.*)/ ... !defined $count2 or next;
22 unless (defined $count2) {
23 # header row if no td separator
24 $mobile = $id !~ /non mobile/;
28 # convert to usable syntax
29 my ($browser, $version) = split /\h+/, $id || ' ', 2;
34 when (['Firefox', 'Iceweasel']) {
35 $browser = $mobile ? 'and_ff' : 'firefox';
39 $browser = $mobile ? 'ie_mob' : 'ie';
43 $browser = $mobile ? 'op_mob' : 'opera';
45 if (m{\(Mini(.*)\)$}) {
47 ($_) = $1 =~ m{^/(\d+)};
50 s/^\d*\.\d\K.*//; # one significant digit
55 $browser = $mobile ? 'ios_saf' : 'safari';
56 my $numversion = join('.', map { sprintf '%03d', $_ } split /\./, $version);
57 $numversion =~ s/6(?=\d{3})//; # incomparable 6532.22 → 523
59 # http://en.wikipedia.org/wiki/Safari_version_history
72 [ '525.013' => '3.1' ],
73 [ '525.026' => '3.2' ],
79 last if $numversion lt $_->[0];
84 $browser = $mobile ? 'and_chr' : 'chrome';
85 s/\.\d+$// for $version;
96 s/\.0$// for $version;
99 $count{$browser}{$version} += $count;
110 curl http://stats.wikimedia.org/archive/squid_reports/2010-10/SquidReportClients.htm |
111 ./mkusage-wikimedia > browser-usage.inc.pl