Skip to content

Instantly share code, notes, and snippets.

@changemewtf
Created May 1, 2025 17:18
Show Gist options
  • Save changemewtf/1a11c544bf2a9be0f911762692e9b5b2 to your computer and use it in GitHub Desktop.
Save changemewtf/1a11c544bf2a9be0f911762692e9b5b2 to your computer and use it in GitHub Desktop.
import requests
# 'Host': 'www.fightcade.com',
# 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:137.0) Gecko/20100101 Firefox/137.0',
# 'Accept': 'application/json, text/plain, */*',
# 'Accept-Language': 'en-US,en;q=0.5',
# 'Accept-Encoding': 'gzip, deflate',
# 'Content-Type': 'application/json;charset=utf-8',
# 'Origin': 'https://www.fightcade.com',
# 'Referer': 'https://www.fightcade.com/id/Tonren',
# 'Cookie': 'cf_clearance=gVpaOGa7hGGeHCt.gu4rjFUtoiFTlXvRpRxflh0O9As-1744823962-1.2.1.1-UCfh1OuYBIyJWVArkIw1Qq5zF3FAp1.tg_9tzdaa0kraKKeqKAVUPbV8VpojnA1hU2B.etJDyziqFrqi24iXl2adgu1yMGUMtuheUICQmeRC8pL5IZE5KFSTIL9FyD93i8klMbFXS31YIHRO6VrhoRzE2XgSKRxP2llTIA9aq.7G3OBQCTjjI8qgFAoU1vGaWsGdPI7pL3UKsQge2PAFgR7PZLIvBHbb0qwFNnBB_0gROXEcBBTsGnlv26OoPPrmydf0Iyka3YcLv7FK9zzgtcQRcGH4DTg8zjhiY_scN3T_EAAOB2irGb1N9DBp6yPjZ04VPqqT9sFfqVi0ks4Xg8p2X0TXP1LWqOtInDEI.YM',
def get_profile_page(username):
s = requests.Session()
print(s.headers)
headers = {
'Host': 'www.fightcade.com',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:137.0) Gecko/20100101 Firefox/137.0',
'Accept': 'application/json, text/plain, */*',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate',
'Content-Type': 'application/json;charset=utf-8',
'Content-Length': '37',
'Origin': 'https://www.fightcade.com',
'DNT': '1',
'Connection': 'keep-alive',
'Referer': 'https://www.fightcade.com/id/Tonren',
'Cookie': 'cf_clearance=gVpaOGa7hGGeHCt.gu4rjFUtoiFTlXvRpRxflh0O9As-1744823962-1.2.1.1-UCfh1OuYBIyJWVArkIw1Qq5zF3FAp1.tg_9tzdaa0kraKKeqKAVUPbV8VpojnA1hU2B.etJDyziqFrqi24iXl2adgu1yMGUMtuheUICQmeRC8pL5IZE5KFSTIL9FyD93i8klMbFXS31YIHRO6VrhoRzE2XgSKRxP2llTIA9aq.7G3OBQCTjjI8qgFAoU1vGaWsGdPI7pL3UKsQge2PAFgR7PZLIvBHbb0qwFNnBB_0gROXEcBBTsGnlv26OoPPrmydf0Iyka3YcLv7FK9zzgtcQRcGH4DTg8zjhiY_scN3T_EAAOB2irGb1N9DBp6yPjZ04VPqqT9sFfqVi0ks4Xg8p2X0TXP1LWqOtInDEI.YM',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin',
'Sec-GPC': '1',
}
s.headers = headers
query = {
'req': "getuser",
'username': username
}
r = requests.post("https://www.fightcade.com/api/", headers=headers, json=query)
print("Got response with status code ", r.status_code)
print(r.text)
def xget_profile_page(username):
s = requests.Session()
headers = {
'Host': 'www.fightcade.com',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:137.0) Gecko/20100101 Firefox/137.0',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'en-US,en;q=0.5',
#'Accept-Encoding': 'gzip, deflate, br, zstd',
'DNT': '1',
'Connection': 'keep-alive',
'Cookie': 'cf_clearance=4zAd_CiS7wXWz_yj2AWwIYwUeuvpsPLcWuDCHsp45A8-1744822160-1.2.1.1-kaQ.8RBzWJOOZLwF8Qq_dYC51v9K_B7keMn8SgdFDtAUDda_axWeMqEaRYheC8YA5zqUUZ1Iklpb4mpmLpOS0k5fmIpBT5C4mvCOW2bTccxCs.bm8n7l1FPb0b.QCixFxA_O8PvMaDFcYjrxu6iuv2BzD.cmOhXPaoRrU07VEmiaUEvs6vpseiKNURxzOxKWjqMHq8DHh3S583Y9M3wFkZOFYKRu.lqbZn2BUfLJKd4kB9W1xBNI16Que3hv4E0ZLDDIxODhR7OiHyfbVE2RYR7B5qJhJfKfmcJYT49kmWDVWQ4BiDAs40b1DZT8vvt9DhhhULL0b59940BrvwPYtyHLuuuEeV0Bzaid__qpoOk',
'Upgrade-Insecure-Requests': '1',
'Sec-Fetch-Dest': 'document',
'Sec-Fetch-Mode': 'navigate',
'Sec-Fetch-Site': 'cross-site',
'Sec-GPC': '1',
'Priority': 'u=4',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache',
}
r = requests.get("https://fightcade.com/id/Tonren", headers=headers)
if r.status_code == 500:
raise Exception("Server error (500): " + r.text)
elif r.status_code == 403:
raise Exception("Request error (403):" + r.text)
print(r.text)
def get_data(query):
r = requests.post(
"https://www.fightcade.com/api/",
json=query
)
if r.status_code == 500:
raise IOError("Unable to get data")
elif r.status_code == 403:
raise Exception("403 error:", r.text)
else:
return r
def get_ranked_replays(game, username=None, pages=None):
query = {"req": "searchquarks", "best": True, "gameid": game}
if username is not None:
query['username'] = username
replays = []
if pages is None:
query['offset'] = 0
r = get_data(query)
replays += r.json()['results']['results']
else:
for page in range(0, pages):
query['offset'] = page
r = get_data(query)
replays += r.json()['results']['results']
print(replays)
get_profile_page('Tonren')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment