Skip to content

Instantly share code, notes, and snippets.

@JRaspass
Created April 28, 2020 10:50
Show Gist options
  • Save JRaspass/3a8e8d6cc6587aa715a45e3fce6b5bfa to your computer and use it in GitHub Desktop.
Save JRaspass/3a8e8d6cc6587aa715a45e3fce6b5bfa to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use constant RAT => '...';
use HTTP::Tiny;
use JSON::PP;
my $ua = HTTP::Tiny->new;
for (qw(AthenasFortune GoldHoarders MerchantAlliance OrderOfSouls ReapersBones)) {
my $res = $ua->get(
"https://www.seaofthieves.com/api/ledger/$_",
{ headers => { Cookie => 'rat=' . RAT } },
);
die $res->{content} unless $res->{success};
my $json = decode_json $res->{content};
my $rank = $json->{user}{rank};
my $total = $json->{Bands}[-1]{Results}[-1]{Rank};
printf "%16s %4.1f%% %5d/%d\n", $_, 100 * $rank / $total, $rank, $total;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment