Skip to content

Instantly share code, notes, and snippets.

@jcxldn
Created October 28, 2021 08:05
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 jcxldn/ac3d8978be30f4ed859b9328f5eb581d to your computer and use it in GitHub Desktop.
Save jcxldn/ac3d8978be30f4ed859b9328f5eb581d to your computer and use it in GitHub Desktop.
Get Profile Pic from Xbox Live
import requests
import json
gamertag = "Major Nelson"
def getProfilePic(gamertag):
r = requests.get("https://xbl-api.prouser123.me/profile/settings/gamertag/%s" % requests.utils.quote(gamertag), headers={"User-Agent": "solars-project"})
if (r.status_code == 200):
data = json.loads(r.text)
# Make sure we have the right setting
if (data["profileUsers"][0]["settings"][3]["id"] == "PublicGamerpic"):
# Return the url
return data["profileUsers"][0]["settings"][3]["value"]
else:
return "profile pic not found"
else:
return "gamertag not found"
print(getProfilePic(gamertag))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment