replace depricated username history api
This commit is contained in:
parent
e8b52b9721
commit
53bd248bdd
1 changed files with 3 additions and 4 deletions
|
@ -40,14 +40,13 @@ class MinecraftCollector(object):
|
|||
self.player_map = dict()
|
||||
|
||||
def uuid_to_player(self, uuid):
|
||||
uuid = uuid.replace('-', '')
|
||||
if uuid in self.player_map:
|
||||
return self.player_map[uuid]
|
||||
else:
|
||||
try:
|
||||
result = requests.get('https://api.mojang.com/user/profiles/' + uuid + '/names')
|
||||
self.player_map[uuid] = result.json()[-1]['name']
|
||||
return (result.json()[-1]['name'])
|
||||
result = requests.get('https://sessionserver.mojang.com/session/minecraft/profile/' + uuid)
|
||||
self.player_map[uuid] = result.json()['name']
|
||||
return (result.json()['name'])
|
||||
except:
|
||||
return
|
||||
|
||||
|
|
Loading…
Reference in a new issue