サーモンランしかやってないのですが、これが記録を見るのにイカリング2を使っても50個までしか残してくれないので、statを残してくれる以下のサイトを利用した。
Nintendo Switch Online にどうやってアクセスするのか?
これがNintendo Switch Onlineのログイン連携をしてさらにstat.inkにデータを投げてくれるそうだ。
というわけでsplatnet2statinkのセットアップ
前提として私は
- stat.inkにアカウントを作成してAPIトークンを取得している。
- Debian10のサーバーをさくらインターネットのVPSで使っている。
- Debian10では以下の通りのPython環境
itoh@debian10:~$ python3 --version Python 3.7.3 itoh@debian10:~$ pip3 --version pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)
こんな感じ。
git cloneする
itoh@debian10:~$ git clone git@github.com:frozenpandaman/splatnet2statink.git Cloning into 'splatnet2statink'... remote: Enumerating objects: 4, done. remote: Counting objects: 100% (4/4), done. remote: Compressing objects: 100% (4/4), done. remote: Total 1644 (delta 0), reused 1 (delta 0), pack-reused 1640 Receiving objects: 100% (1644/1644), 718.44 KiB | 998.00 KiB/s, done. Resolving deltas: 100% (1032/1032), done.
Pythonライブラリをpipでインストール
itoh@debian10: ~$ cd splatnet2statink itoh@debian10:~/splatnet2statink$ pip3 install -r requirements.txt Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from -r requirements.txt (line 1)) (2.21.0) …(省略) Successfully built msgpack-python Installing collected packages: msgpack-python, pillow Successfully installed msgpack-python-0.5.6 pillow-8.0.1
セットアップする
初回のsplatnet2statink.py実行時にはNitendo Switch Onlineとの連携を行う。
itoh@debian10:~/splatnet2statink$ python3 splatnet2statink.py splatnet2statink v1.5.6 Generating new config file. stat.ink API key:
で、stat.inkのAPI keyを聞かれるので stat.inkからAPIトークンを取得してコピペしてEnter
itoh@debian10:~/splatnet2statink$ python3 splatnet2statink.py splatnet2statink v1.5.6 Generating new config file. stat.ink API key: brNbtU########################2QlJSM Default locale is en-US. Press Enter to accept, or enter your own (see readme for list).
ロケールがen-USなので好きなのを選ぶ。どの言語があるかreadmeを見てくれってある。READMEに以下のリンク
https://github.com/frozenpandaman/splatnet2statink/wiki/languages
があるのでja-JPを選ぶ。ja-JPと入力してEnter
ja-JP Pulling data from online... Blank cookie. session_token is blank. Please log in to your Nintendo Account to obtain your session_token. Make sure you have fully read the "Cookie generation" section of the readme before proceeding. To manually input a cookie instead, enter "skip" at the prompt below. Navigate to this URL in your browser: https://accounts.nintendo.com/connect/1.0.0/authorize?state=dvhNzrn_TlYge(省略)=login_form Log in, right click the "Select this account" button, copy the link address, and paste it below:
って出るのでこの https://accounts.nintendo.com/connect/1.0.0/authorize... って出てるURLにアクセスする。その前にNitendoアカウントにログインしておくこと。
すると、
という画面になるので、「この人にする」のリンク先URLをコピーする。
Log in, right click the "Select this account" button, copy the link address, and paste it below:
自分の場合、 npf71b963c1b7b6d119://auth#session_state=af... みたいなURLだった。
Wrote session_token to config.txt. Attempting to generate new cookie... Wrote iksm_session cookie for YOURACCOUNT to config.txt. Pulling data from online...
これでセッション情報が保存される。
最近の50戦の戦績をstat.inkにアップロードする。
Number of recent battles to upload (0-50)? 50
なかなかひどい戦績だ…
スクリプトの定期実行
splatnet2statink.pyスクリプトの使い方…
$ python splatnet2statink.py [-M [N]] [-r] [-s] [-t] [--salmon] The -M flag runs the script in monitoring mode, uploading new battle results as you play matches. The script checks for new battles every N seconds; if no N is provided, the script defaults to 300 (5 minutes). The -r flag uploads any recent battle records present on SplatNet 2 that haven't been uploaded to stat.ink. The -s flag blacks out other players' names on the scoreboard result image and doesn't send them to stat.ink. The -t flag sends battle data to stat.ink as a dry run, without uploading, for testing/validation purposes. The --salmon flag updates your Salmon Run profile and allows you to upload jobs (shifts) worked.
こんな感じかな?
- Mオプションで、モニタリングモード。バトルしている時にはこれをつけて実行しておくといのかな?-M 900 とすると15分に1回Nitendo Switch Onlineにアクセスして記録をアップロードしてくれるみたい。あんまり小さい値だとNitendo Switch Onlineからバンされそうなのでデフォルトの300がミニマムくらいのつもりかな。
- rオプションで、イカリング2(海外ではSplatNet2)からデータを取得してstat.inkにアップロード
- sオプションで他プレイヤーの名前を非表示にするようにstat.inkに設定する。
- tオプションでテストRUNする。
- --salmonオプションはサーモンランの記録を取る。 さっきから何もプレイしないで
itoh@debian10:~/splatnet2statink$ python3 splatnet2statink.py -r -t
とすると、当然
splatnet2statink v1.5.6 Checking if there are previously-unuploaded battles... No previously-unuploaded battles found.
となる。
サーモンランの記録をつける
ということで、ようやく念願の…
itoh@debian10:~/splatnet2statink$ python3 splatnet2statink.py --salmon splatnet2statink v1.5.6 Pulling Salmon Run data from online... Successfully updated your Salmon Run profile. Number of recent Salmon Run shifts to upload (0-50)? 50
おー。取れてる取れてる。
で、後は
$ python3 splatnet2statink.py --salmon -r
を定期実行させればいいのかな。