Scraping tools for Nintendo games and prices on NA, EU and JP.
Project description
nintendeals
"nintendeals was a bot, he loved learning and deals on nintendo's eshop." LetsFunHans 💬️
Named after the my old reddit bot, nintendeals is now a library with all the scrapers and integrations of nintendo services that I used.
Terminology
Before getting into any details first we need too get into the same page with a few terms:
Region
Here we have three regions NA, EU and JP each one corresponding to Nintendo of America (NoA), Nintendo of Europe (NoE) and Nintendo of Japan (NoJ). Each of these regions have set of countries they are "in charge of":
NoA:
- Canada
- Mexico
- United Stated
NoE:
- Every country in the European Union
- Australia
- New Zealand
- South Africa
NoJ:
- Japan
nsuid
An nsuid is a 14 digit long string which Nintendo uses to identify games on each region. Taking Breath of the Wild as an example, we have these 3 nsuids for it (one per region):
- "70010000000025" (NA)
- "70010000000023" (EU)
- "70010000000026" (JP)
Product Code
The product code is another type of ID that Nintendo uses, it usually is a 8/9 character long string. Taking Splatoon 2 as an example, we have these 3 product codes for it (one per region):
- "HACPAAB6B" (NA)
- "HACPAAB6C" (EU)
- "HACAAB6A" (JP)
The difference with the nsuid is that (as you can see bolded) the product code has a constant between all regions, and this is what I decided to call unique_id and it is what we can you to join a game across all regions.
You can also see this code in the front of your Nintendo Switch cartridge.
Services
This library provides three types of services: Info, Listing, Searching and Pricing. Each region has a different version of Info, Listing and Searching, but Pricing is the same for all as it only requires a country and an nsuid.
Listing
Even thought there are different version for each region, they all work in the same way. Given a supported platform (for this library) they will retrieve a list games in the selected region (in the form of an iterator).
from nintendeals import noa
for game in noa.list_switch_games():
print(game.title, "/", game.nsuid)
>> ARMS / 70010000000392
>> Astro Duel Deluxe / 70010000000301
>> Axiom Verge / 70010000000821
>> Azure Striker GUNVOLT: STRIKER PACK / 70010000000645
>> Beach Buggy Racing / 70010000000721
from nintendeals import noe
for game in noe.list_switch_games():
print(game.title, "/", game.nsuid)
>> I and Me / 70010000000314
>> In Between / 70010000009184
>> Ghost 1.0 / 70010000001386
>> Resident Evil 0 / 70010000012848
>> 64.0 / 70010000020867
Searching
Built on top of the listing services, these provide a simple way to search for games by title or release_date:
from nintendeals import noa
for game in noa.search_switch_games(title="Zelda"):
print(game.title, "/", game.nsuid)
>>> The Legend of Zelda: Breath of the Wild / 70010000000025
>>> The Legend of Zelda: Breath of the Wild - Master Edition / None
>>> The Legend of Zelda: Breath of the Wild - Special Edition / None
>>> The Legend of Zelda: Breath of the Wild Explorer's Edition / None
>>> The Legend of Zelda: Breath of the Wild: Starter Pack / None
>>> The Legend of Zelda: Link's Awakening / 70010000020033
>>> The Legend of Zelda: Link's Awakening: Dreamer Edition / None
>>> Cadence of Hyrule - Crypt of the NecroDancer Featuring the Legend of Zelda / 70010000021364
from datetime import datetime
from nintendeals import noe
for game in noe.search_switch_games(
title="Hollow Knight",
released_before=datetime(2018, 12, 31)
):
print(game.title, "/", game.nsuid)
>> Hollow Knight / 70010000003207
Info
Once you have the nsuid of the game that you want, you can call the game_info
service. And again, each region has their
own version but they all work the same, but keep in mind that you need to use the correct nsuid for each region.
Coming back to the nsuid of Breath of the Wild as an example:
from nintendeals import noa
game = noa.game_info(nsuid="70010000000025")
print(game.title)
print(game.unique_id)
print(game.release_date)
print(game.players)
print(game.dlc)
The Legend of Zelda™: Breath of the Wild
AAAA
2017-03-03 00:00:00
1
True
from nintendeals import noe
game = noe.game_info(nsuid="70010000000023")
print(game.title)
print(game.unique_id)
print(game.release_date)
print(game.players)
print(game.dlc)
>> The Legend of Zelda: Breath of the Wild
>> AAAA
>> 2017-03-03 00:00:00
>> 1
>> True
Keep in mind that each call to these services will trigger a call to a nintendo eshop website.
Pricing
Given a country code (using the alpha-2 iso standard) and a game or list of games this service will fetch the current pricing of that/those games for that country. Since this service uses nsuids to fetch the price, make sure that the games that you provide have the regional nsuid that matches the country that you want. For example, only the nsuid for the American region will be able to fetch you the prices of Canada, Mexico and United Stated but not for Japan or Spain.
from nintendeals import noe
from nintendeals.api import prices
game = noe.game_info(country="70010000007705")
print(game.title)
print()
price = prices.get_price(country="CZ", game=game) # Czech Republic
print(price.currency)
print(price.value)
print(price.sale_discount, "%")
print(price.sale_value)
print(price.sale_start)
print(price.sale_end)
# Alternatively you can do this for the same effect:
price = game.price(country="CZ")
Dead Cells
CZK
625.0
80 %
500.0
2020-04-19 22:00:00
2020-05-03 21:59:59
To reduce the amount of call to the prices api, you can also use the get_prices
service that works in a similar way
but it expects a list of games instead of only one:
from nintendeals import noa
from nintendeals.api import prices
botw = noa.game_info(nsuid="70010000000025")
print(botw.title)
celeste = noa.game_info(nsuid="70010000006442")
print(celeste.title)
prices = prices.get_prices(country="US", games=[botw, celeste])
for nsuid, price in prices:
print(nsuid)
print(price.value)
print(price.sale_value)
print()
The Legend of Zelda™: Breath of the Wild
Celeste
70010000000025
59.99
None
70010000006442
19.99
4.99
To Do list
- Improve exception management for unexisting games or prices
- Improve performance
- Lazy attributes on Game class to reduce scraping.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file nintendeals-1.5.tar.gz
.
File metadata
- Download URL: nintendeals-1.5.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 965eb213950405f4896d055d6d9015b19a1fbdae74e559f4df33c75ee92e3a9c |
|
MD5 | 37124617c7fd385b84810150202ba97d |
|
BLAKE2b-256 | af416cb126bcc7c5cfb3de12bcd115cea293a30e015ab149391e5fa0662ca8e8 |
File details
Details for the file nintendeals-1.5-py3-none-any.whl
.
File metadata
- Download URL: nintendeals-1.5-py3-none-any.whl
- Upload date:
- Size: 27.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff8ca8f5ea0643c9eeae719e1d0b04a3c58c33b5f3aa20b50a10e8ab2b844431 |
|
MD5 | 06dcaf342aa0fa5497ef94d23be57231 |
|
BLAKE2b-256 | 18103e1ce0d25ad3e49db612359800c8debeb75189f76f96bd37437417ba2d66 |