Created
April 18, 2021 15:03
-
-
Save FaltoGH/9f53e61245caf251a6d38f4d51df7af5 to your computer and use it in GitHub Desktop.
hypixel zest guild /g top
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
API_KEY = 'INPUT YOUR API KEY' | |
import requests | |
def convertUUID(UUID): | |
igns = requests.get(f'https://api.mojang.com/user/profiles/{UUID}/names').json() | |
return igns[-1]['name'] | |
data = requests.get(f'https://api.hypixel.net/guild?key={API_KEY}&name=zest').json() | |
guildExp = {} | |
guildMembers = data['guild']['members'] | |
for member in guildMembers: | |
todayExp = list(member['expHistory'].values())[0] | |
uuid = member['uuid'] | |
guildExp[uuid] = todayExp | |
guildExp = {k: v for k, v in sorted(guildExp.items(), key=lambda item: item[1], reverse=True)} | |
top = 1 | |
for playerExp in guildExp: | |
print(f'{top}. {convertUUID(playerExp)} - {guildExp[playerExp]}') | |
top += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment