Created
September 26, 2021 09:00
-
-
Save yuiseki/9c53072dd13a07dc8c5ab091ae4ba92b to your computer and use it in GitHub Desktop.
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
import requests | |
# https://xbl.io/ | |
OPENXBL_TOKEN = "<your OpenXBL token>" | |
# https://account.xbox.com/Profile?xr=mebarnav | |
REALMS_CLUB_ID = "<your Realms Club ID>" | |
headers = { | |
"X-Authorization": OPENXBL_TOKEN, | |
"Accept": "application/json;charset=UTF-8", | |
} | |
club_res = requests.get( | |
"https://xbl.io/api/v2/clubs/" + REALMS_CLUB_ID, | |
headers=headers | |
) | |
club_json = club_res.json() | |
realms_name = club_json["clubs"][0]["profile"]["name"]["value"] | |
print(realms_name + "にオンラインの住民") | |
residents = club_json["clubs"][0]["clubPresence"] | |
for person in residents: | |
if person["lastSeenState"] == "InGame": | |
person_res = requests.get( | |
"https://xbl.io/api/v2/account/" + person["xuid"], | |
headers=headers | |
) | |
person_json = person_res.json() | |
for setting in person_json["profileUsers"][0]["settings"]: | |
if setting["id"] == "Gamertag": | |
print(setting["value"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment