From: Mischa POSLAWSKY Date: Wed, 21 Aug 2019 21:56:52 +0000 (+0200) Subject: define common region/realm request path X-Git-Tag: v0.5~7 X-Git-Url: http://git.shiar.nl/sc2-widget/commitdiff_plain/d16a6c90ab992881c1e4fb01f9aeee819c7da84c define common region/realm request path Name mysterious parameters used to access profile data. Subdivision values are for Europe as documented on: Remains hardcoded without support for configurable region and adaptability for multiple realms (no Russian members yet). --- diff --git a/getsc2clan b/getsc2clan index cc38e4d..0299082 100755 --- a/getsc2clan +++ b/getsc2clan @@ -18,6 +18,7 @@ $profiles && @{$profiles} or die "Usage: $0 ... [...]\n"; my ($clanmatch) = map { $_ && qr/\A(?:$_)\z/i } join '|', @{$clanmatches || []}; +my @realmget = (profile => 2 => 1); # common request path for european data sub blizget { state $bliz = do { my @authdata = do './.blizzard.passwd.pl' and not $@ || $! @@ -40,7 +41,7 @@ sub blizget { # prefer deprecated interface to prevent costly ladder search my @ladderdata = map { - blizget(legacy => profile => 2 => 1 => $_ => 'ladders') + blizget(legacy => @realmget => $_ => 'ladders') } @{$profiles}; # merge relevant ladder data of all users @@ -87,7 +88,7 @@ say JSON->new->canonical->pretty->encode({ @ladders ], members => [map { - blizget(metadata => profile => 2 => 1 => $_->{id}) + blizget(metadata => @realmget => $_->{id}) # lacks mmr, fav race (available in new api) } @members], }) =~ s/(?: \G \d,? | \[ ) \K \s+ (?=\d|\])/ /grx; # concat arrays of single digits