Created
October 28, 2021 08:05
-
-
Save jcxldn/ac3d8978be30f4ed859b9328f5eb581d to your computer and use it in GitHub Desktop.
Get Profile Pic from Xbox Live
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 | |
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