mirror of
https://github.com/Coldsmiles/infstarweb.git
synced 2026-06-07 04:11:13 +08:00
feat: 更新获取玩家名称的逻辑,添加新的API请求
This commit is contained in:
@@ -88,6 +88,26 @@ def get_player_name(uuid):
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
response = get_session().get(
|
||||||
|
f"https://littleskin.cn/api/yggdrasil/sessionserver/session/minecraft/profile/{uuid}",
|
||||||
|
timeout=5,
|
||||||
|
)
|
||||||
|
if response.status_code == 200:
|
||||||
|
return response.json().get("username")
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
response = get_session().get(
|
||||||
|
f"https://skin.infstar.cn/api/yggdrasil/sessionserver/session/minecraft/profile/{uuid}",
|
||||||
|
timeout=5,
|
||||||
|
)
|
||||||
|
if response.status_code == 200:
|
||||||
|
return response.json().get("username")
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
return "Unknown"
|
return "Unknown"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user