Last active
March 8, 2022 23:22
-
-
Save LucienHH/0bf61e1e2b4434921cfb2da76f4e349c to your computer and use it in GitHub Desktop.
Get players in an Xbox club
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
const { Authflow } = require('prismarine-auth') | |
const axios = require('axios') | |
const CLUB_URL = 'https://clubhub.xboxlive.com/clubs/me/decoration/detail' | |
const PEOPLE_URL = 'https://peoplehub.xboxlive.com/users/me/people/batch/decoration/detail,presencedetail' | |
const flow = new Authflow() | |
async function main() { | |
const xbl = await flow.getXboxToken(); | |
const headers = { authorization: `XBL3.0 x=${xbl.userHash};${xbl.XSTSToken}`} | |
const club = await axios(CLUB_URL, { headers }).then(e => e.data.clubs.find(res => res.name === '<club_name>')) | |
const inClubPlaying = club.clubPresence.filter(e => e.lastSeenState == 'InGame').map(u => u.xuid); | |
const players = await axios(PEOPLE_URL, { method: 'POST', headers, data: { xuids: inClubPlaying } }).then(e => e.data); | |
console.log(players) | |
} | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment