Skip to content

Instantly share code, notes, and snippets.

@LucienHH
Last active March 8, 2022 23:22
Show Gist options
  • Save LucienHH/0bf61e1e2b4434921cfb2da76f4e349c to your computer and use it in GitHub Desktop.
Save LucienHH/0bf61e1e2b4434921cfb2da76f4e349c to your computer and use it in GitHub Desktop.
Get players in an Xbox club
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