replace depricated username history api

This commit is contained in:
Joshua Grimm 2022-09-15 11:38:57 +02:00
parent e8b52b9721
commit 53bd248bdd

View file

@ -40,14 +40,13 @@ class MinecraftCollector(object):
self.player_map = dict() self.player_map = dict()
def uuid_to_player(self, uuid): def uuid_to_player(self, uuid):
uuid = uuid.replace('-', '')
if uuid in self.player_map: if uuid in self.player_map:
return self.player_map[uuid] return self.player_map[uuid]
else: else:
try: try:
result = requests.get('https://api.mojang.com/user/profiles/' + uuid + '/names') result = requests.get('https://sessionserver.mojang.com/session/minecraft/profile/' + uuid)
self.player_map[uuid] = result.json()[-1]['name'] self.player_map[uuid] = result.json()['name']
return (result.json()[-1]['name']) return (result.json()['name'])
except: except:
return return