Mercurial > codedump
view getskin.py @ 133:0d8eabdd12ab default tip
create: write H:MM:SS timestamps, add option to fill with gaussian-blur instead of black
many albums are longer than one hour so writing H:MM:SS is a
necessity. if anything there will just be verbose info that
isn't important for my use-case.
however the gaussian-blur is simply broken. It works, and it plays
locally just fine, but YouTube in particular elongates the video
to fit the full width. I'm not entirely sure why it does this, but
it makes it useless and ugly.
| author | Paper <paper@tflc.us> |
|---|---|
| date | Sat, 03 Jan 2026 20:25:38 -0500 |
| parents | eac6dae753ca |
| children |
line wrap: on
line source
# minecraft skin fetcher # by Paper, 2021-07-13 # this only really exists as reference to a possible java implementation # (for those beta versions of minecraft that don't support UUIDs) # however, i do not have any java experience, like, at all # so that'll be fun! # # update 2023-03-03: it was never written LOL import argparse import base64 import cv2 import json import numpy import urllib.request def get_status_code(mcign): return urllib.request.urlopen(f"https://api.mojang.com/users/profiles/minecraft/{mcign}").getcode() # parse arguments parser = argparse.ArgumentParser() parser.add_argument('-c', '--crop', help='crops your skin to 64x32, for beta versions', action="store_true") parser.add_argument('-u', '--username', help='minecraft in-game name') args = parser.parse_args() # parse username, probably unnecessarily long but idc if args.username: myname = args.username try: statuscode = get_status_code(myname) except: myname = input("What is your Minecraft username?: ") statuscode = get_status_code(myname) finally: while statuscode == 204: myname = input("What is your Minecraft username?: ") statuscode = get_status_code(myname) skinlink = json.loads(base64.b64decode(json.loads(urllib.request.urlopen(f'https://sessionserver.mojang.com/session/minecraft/profile/{json.loads(urllib.request.urlopen("https://api.mojang.com/users/profiles/minecraft/{0}".format(myname)).read().decode("utf-8"))["id"]}').read().decode("utf-8"))["properties"][0]["value"]).decode("utf-8"))["textures"]["SKIN"]["url"] # get your free long lines here! skin = numpy.asarray(bytearray(urllib.request.urlopen(skinlink).read()), dtype="uint8") skin = cv2.imdecode(skin, cv2.IMREAD_UNCHANGED) # this is worthless if your skin is already 64x32 if args.crop: skin = skin[0:32, 0:64] # write the final skin cv2.imwrite("skin.png", skin)
