本文编写于 131 天前,最后修改于 17 天前,其中某些信息可能已经过时。

有关API接口

  • 查询UUID

    `https://api.mojang.com/users/profiles/minecraft/{name}` 
    
  • 查询曾用名

    `https://api.mojang.com/user/profiles/{uuid}/names`
    
  • 查询皮肤

    `https://sessionserver.mojang.com/session/minecraft/profile/{uuid}`
    

简单实现源码

#! python3
#by Gamous 2020/3/2
import base64,json,os
import requests

def get_uuid(name):
    return json.loads(requests.get('https://api.mojang.com/users/profiles/minecraft/'+name).text)["id"]
def get_history(uuid):
    history = json.loads(requests.get('https://api.mojang.com/user/profiles/%s/names'%uuid).text)
    for used in history:
        print("[USED]:"+used["name"])
def get_skin(uuid):
    return json.loads(base64.b64decode(json.loads(requests.get('https://sessionserver.mojang.com/session/minecraft/profile/'+uuid).text)["properties"][0]["value"]))["textures"]["SKIN"]["url"]
def down_skin(url,path):
    if not os.path.exists("./skin"):
        os.makedirs("./skin") 
    with open(path, 'wb') as f:
        f.write(requests.get(url).content)
    print("[INFO]:Skin downloaded on "+path)
name=input("[NAME]:")
uuid=get_uuid(name)
print("[UUID]:"+uuid)
get_history(uuid)
skin=get_skin(uuid)
print("[SKIN]:"+skin)
down_skin(skin,"./skin/[%s]%s.jpg"%(name,uuid))