Skip to content

Instantly share code, notes, and snippets.

@ariankordi
Created July 30, 2017 11:59
Show Gist options
  • Save ariankordi/7c2e07a505a5c6415d0f3f565036ad0c to your computer and use it in GitHub Desktop.
Save ariankordi/7c2e07a505a5c6415d0f3f565036ad0c to your computer and use it in GitHub Desktop.
Little script to get a Mii from an NNID using miiverse.nintendo.net (and lxml + urllib)
from lxml import html
from urllib.request import urlopen
import sys
if not sys.argv[1]:
print("UsagE: " + sys.argv[0] + " [NNID to get Mii from]")
ftree = html.fromstring(urlopen('https://miiverse.nintendo.net/users/{0}/favorites'.format(sys.argv[1])).read())
miihash = ftree.xpath('//*[@id="sidebar-profile-body"]/div/a/img/@src')[0].split('.net/')[1].split('_n')[0]
screenname = ftree.xpath('//*[@id="sidebar-profile-body"]/a/text()')[0]
print(miihash, screenname)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment