Have you ever finished a game and found yourself at a loss for what to play next? I certainly have. I recently finished playing The Legend of Zelda: Breath of the Wild, and I was looking for some recommendations for my next game. I couldn’t find a good recommendation system online, so I decided to write my own.
This is not intended for wide public usage, mostly it’s just a weekend hack for personal use.
I decided to use my Chromebook, Bard / ChatGPT, and Github Codespaces to build my own recommendation system. I wanted to keep it minimal and avoid setting up all the different environments I needed, like node env, typescript, Go env, Jupyter Notebooks, and more. Why I needed different envs? keep reading. This made it easier to focus on the task at hand: building a game recommendation system that worked for me. Codespaces is a great way to develop and gives you web-based VSCode, terminal access, and many more, plus it’s free up to 120 hours/month.
Fetching installed games from the Nintendo device
My first step was to fetch all the games I had played from my Nintendo Switch device. However, it’s not as straightforward as it seems. Sure, there are several sites that allow you to track the games, add them to your library, and even share the lists but none of them track games automatically, You need to update them manually, every time. And there’s a reason why it’s so tedious — Nintendo made it that way. Basically, you can’t get the list of games you played from Nintendo API because data is stored on the device + authentication is very hard. But there is a workaround.
You can install Nintendo Parental Control which basically controls everything on a Nintendo device. It doesn’t have access to historical data but after the installation, it can track anything. On the other end, Nintendo Parental Control is an app on mobile phones where you clearly see all the games and play times. Voila! What’s left is to set up a proxy, debug network calls and replicate it. Fortunately, I’m not the only one with this problem so some folks have crafted really nice libraries around it, for example, nxapi,
GitHub - samuelthomas2774/nxapi: Nintendo Switch Online/Parental Controls app APIs. Show your…
Nintendo Switch Online/Parental Controls app APIs. Show your Nintendo Switch presence in Discord, get friend…
Keep in mind, it might take time to track all the games, I already had Nintendo Parental Control installed since last year (another hacky project), so it had access to all my games
I just quickly set up GitHub codespaces with Go env (why not? love Go), installed necessary dependencies dependency, and fetched all my games from all the Nintendo accounts on-device. As a result, you’ll get JSON files based on your play data. This is the whole script to fetch the games and then parse the JSON by your account and get distinct games.
Fetching available Nintendo games and review scores
As a next step, we need to access the Nintendo game database. It is essential for creating clusters of games by features (we will talk later) and recommending games from the Nintendo library. Initially, I thought that would be easy and the hardest part was to access on-device games only. I was wrong.
The only publicly accessible Nintendo database I found is this from Kaggle: https://www.kaggle.com/datasets/mrmorj/nintendo-games-dataset, it comes with Metacritic scores and other helpful data but hasn’t been updated in 3 years.
So I had to fetch all the games from the Nintendo US store (a region where your account is registered) and then fetch the MetaCritic score because Nintendo doesn’t have a review system yet. We are talking about 6700+ games. Luckily enough I found this library that helped me to fetch the games and store only the fields I needed in JSON. Quickly spun up another Github Codespace with Typescript env and got the games downloaded.
Note: Every Nintendo store is different and contains different data fields, so code varies accordingly
GitHub - favna/nintendo-switch-eshop: Crawler for Nintendo Switch eShop
Crawler for Nintendo Switch eShop. Contribute to favna/nintendo-switch-eshop development by creating an account on…
Fetching Metacritic score
Now 6700+ game needs review score. The major inconvenience is that Metacritic doesn’t expose API, the only chance to access the review is to parse the HTML and scale this up to 6700+ games. The website looks like that and we are interested in meta score. With the help of ChatGPT, I wrote a parsing function but it’s still not enough. We can’t call 6700+ async functions and store everything to JSON altogether because Codespace is resource-limited and Metacritic is also limiting requests. I decided to split it into batches of 25.
Xenoblade Chronicles 3
Xenoblade Chronicles 3 for Switch game reviews & Metacritic score: "Fighting to liveand living to fight" - A brand new…
Clean up the final JSON, normalize data and that’s it. For detailed info about libraries refer to the original documentation.
Once I had all the data I needed, I used the KMeans function and unsupervised learning to cluster the data by ESRB rating, genre, and Metacritic score. This helped me to identify patterns and similarities between different games, which I could use to make recommendations. I used a set data structure to eliminate duplicates and also removed the games which already were part of the input. Of course, cleaning up the data was a big part of the process. There were a lot of duplicates and inconsistencies that I had to address, but I was able to clean up the data and get it into a format that I could use for my recommendation system.
Here is the Jupyter Notebook code, overall none of the scripts are ideal but it just works which was the original intention.
I was able to build a working recommendation system that could help me find new games to play. The system is not perfect, but it is a good starting point.
Initially, I thought I’d spend 1–2 hours building the system, I assumed many parts were already covered but it evolved into a completely different journey and I’m glad I followed that path, I learned a lot and had lots of fun along the way.
Don’t try this at home:
This project was a bit of a hack, and it is not something that I would recommend that other people try. The Nintendo APIs are not meant to be used for this purpose, and there is a risk that you could get your account banned — I mean it’s Nintendo ¯\_(ツ)_/¯
Follow me on Twitter: