Programming Smogon Usage Parser

Smogon Usage Parser (sup)

https://github.com/GriffinLedingham/smogon-usage-parser

Hey all, I wanted to share a tool I built recently to help out with some data parsing on Pikalytics. I previously had a very convoluted build pipeline which I needed to maintain whenever new data was publish on Smogon. To solve this problem, I came up with a 2-in-1 data fetching & data parsing tool to simplify my workflow for the site.

I built sup in TypeScript for a CLI Node environment. A full(ish) readme is present in the Github repo, with install and usage instructions.

Running sup with all required options will fetch the requested chaos.json, and .txt files from Smogon, and parse them out into a nicely formatted payload as can be seen at the bottom of this post.

I hope that sup can help others innovate and continue to progress this awesome community!
Just please don't try and run Pikalytics out of town using sup to build a direct competitor :psysly:

Disclaimer

Please be considerate in how you use this tool. By nature, this tool relies on Smogon graciously providing public Usage Stats for us to consume. Hammering their servers with this tool may lead to restriction in access for you/others. Be nice! :blobthumbsup:

Output

JSON:
[
    {
        "name": "Incineroar",
        "types": [
            "fire",
            "dark"
        ],
        "stats": {
            "hp": 95,
            "atk": 115,
            "def": 90,
            "spa": 80,
            "spd": 90,
            "spe": 60
        },
        "abilities": [
            {
                "ability": "Intimidate",
                "percent": "99.915"
            },
            ...
        ],
        "raw_count": "492",
        "percent": 86,
        "ranking": 1,
        "viability": "B+",
        "items": [
            {
                "item": "Figy Berry",
                "item_us": "Figy_Berry",
                "percent": "31.073"
            },
            ...
        ],
        "spreads": [
            {
                "nature": "Careful",
                "ev": "236/4/4/0/236/28",
                "percent": "8.263"
            },
            ...
        ],
        "moves": [
            {
                "move": "Fake Out",
                "type": "normal",
                "percent": "99.970"
            },
            ...
        ],
        "team": [
            {
                "pokemon": "Rayquaza-Mega",
                "percent": "47.043",
                "types": [
                    "dragon",
                    "flying"
                ]
            },
            ...
        ]
    },
    ...
]
 
Last edited:

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top