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>/;
20 if (/>Browser engines/ ... m{</table>}) {
21 my $apple = $id =~ s/^AppleWebKit ?//;
23 my ($abs) = m/>showCount\((\d+),/;
26 if (defined $count2) {
31 # replace safari total percentage by individual version counts
32 # have to use combined distribution for multiple platforms :(
33 for my $browser (qw/ safari ios_saf /) {
34 my $multiplier = delete $count{$browser}{'0.0'} or next;
35 $multiplier /= $abs; # total number
36 while (my ($verwebkit, $count) = each %version) {
37 my $ver = safariver($verwebkit, $browser eq 'ios_saf');
38 $count{$browser}{$ver} += $count * $multiplier;
45 />Browser versions(.*)/ ... !defined $count2 or next;
46 unless (defined $count2) {
47 # header row if no td separator
48 $mobile = $id !~ /non mobile/;
52 # convert to usable syntax
53 my ($browser, $version) = split /\h+/, $id || ' ', 2;
58 when (['Firefox', 'Iceweasel']) {
59 $browser = $mobile ? 'and_ff' : 'firefox';
63 $browser = $mobile ? 'ie_mob' : 'ie';
67 $browser = $mobile ? 'op_mob' : 'opera';
69 if (m{\(Mini(.*)\)$}) {
71 ($_) = $1 =~ m{^/(\d+)};
74 s/^\d*\.\d\K.*//; # one significant digit
79 $browser = $mobile ? 'ios_saf' : 'safari';
82 $browser = $mobile ? 'android' : 'chrome';
83 s/\.\d+$// for $version;
94 s/\.0$// for $version;
97 $count{$browser}{$version} += $count;
105 my ($webkitnum, $ios) = @_;
113 [ 531 => '3.2' ], # or 4 from 531.022
121 # http://en.wikipedia.org/wiki/Safari_version_history
124 [ 525 => '3.1' ], # 3.2 from 525.026
126 [ 533 => '5' ], # or 4.1
129 [ 537 => '7.1' ], # or 6.1 or 7.0
133 last if $webkitnum lt $_->[0];
134 $safarinum = $_->[1];
143 curl http://stats.wikimedia.org/archive/squid_reports/2010-10/SquidReportClients.htm |
144 ./mkusage-wikimedia > browser-usage.inc.pl