Created
April 28, 2020 10:50
-
-
Save JRaspass/3a8e8d6cc6587aa715a45e3fce6b5bfa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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