Skip to content

Instantly share code, notes, and snippets.

@yuiseki
Created September 26, 2021 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuiseki/9c53072dd13a07dc8c5ab091ae4ba92b to your computer and use it in GitHub Desktop.
Save yuiseki/9c53072dd13a07dc8c5ab091ae4ba92b to your computer and use it in GitHub Desktop.
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