/splatnet2statink

Takes battle data from the SplatNet 2 app and uploads it to stat.ink.

Primary LanguagePython

splatnet2statink

A script that uploads battle data from the SplatNet 2 app ("Nintendo Switch Online," for use with Splatoon 2) to https://stat.ink/, a site for recording, visualizing, and aggregating statistics from Splatoon and Splatoon 2.

(ja) 日本語版セットアップ手順はこちら

(zh) 中文版的安装说明在这里

Usage

$ python splatnet2statink.py [-M [N]] [-r] [-s] [-t]

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 the data to stat.ink as a dry run, without uploading, for testing/validation purposes.

Note: Executing the script via ./splatnet2statink.py is also possible on macOS or Linux. If you've downloaded a .zip of this repository using the green "Clone or download" button above (instead of via git clone), the script must first be made executable by running chmod +x splatnet2statink.py.

Example usage

Running python splatnet2statink.py -M 900 from the command line launches the script in monitoring mode, checking for and uploading battles every 15 minutes.

Features

  • Complete battle stats
    • Lobby/mode, stage, weapon
    • Result, final count/percent, turf inked
    • Kills, deaths, assists, specials
    • Rank & rank after, level & level after, star levels (★)
    • Battle start & end times
    • Ranked power level & league power
    • Splatfest title, EXP & power
  • Gear + ability recognition
    • New Ver. 2.0.0 gear
    • Gear & user profile image upload
  • Monitoring for new battle results in real-time
  • Scoreboard stats, player ranking & battle result image upload
  • Full automation of SplatNet cookie generation/acquisition via user log-in (more info)
  • Non-English language game support

Setup instructions

  1. Download and install Python 2.7 (pre-installed on macOS) and the package manager pip.

  2. From the command line (macOS: Terminal; Windows: Command Prompt/PowerShell), install the required Python libraries:

    pip install requests
    pip install msgpack-python
    

    If you'll be running splatnet2statink with the -s flag (black out scoreboard names), run pip install pillow as well.

    If you're on Windows with multiple versions of Python installed, you'll have to use py -2 -m pip instead. If the py command is not recognized, use \Python27\python.exe \Python27\Scripts\pip.exe (given you've installed Python 2.7 in the default directory).

  3. Download the script by running git clone https://github.com/frozenpandaman/splatnet2statink.git (requires Git, pre-installed on macOS), or use the green "Clone or download" button above.

  4. Running the script for the first time will prompt you to enter your stat.ink API key, which can be found in your profile settings. If you're using the app in a language other than English, you may enter your language code (locale) as well.

  5. You will then be asked to enter your iksm_session token. To obtain it, follow the mitmproxy instructions here. This token (used to access your SplatNet battle results) along with your stat.ink API key and language will automatically be saved into config.txt for you. You're now ready to upload battles!

  6. Optionally, add custom keys to your config.txt for specialized functionality (e.g. if running the script as a daemon).

Have any questions, issues, or suggestions? Feel free to message me on Twitter or Reddit.

質問があれば、ツイッター(@frozenpandaman)で連絡してください。日本語OK。

Accessing SplatNet 2 from your browser

If you wish to access the SplatNet site from your computer rather than via the phone app, navigate to https://app.splatoon2.nintendo.net/home (it should show a forbidden error). Use a cookie editor (such as EditThisCookie for Chrome) to change iksm_session to the value you obtained previously (stored as cookie in config.txt), and refresh the page. If you only wish to access SplatNet 2 and don't have a stat.ink API key, simply enter "skip" for this step during setup.

Splatoon 2 stage rotation information (including Salmon Run) and current SplatNet gear are viewable at https://splatoon2.ink/.

License

GPLv3