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()
|
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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue