Skip to content

Instantly share code, notes, and snippets.

@downthecrop
Created December 5, 2020 03:03
Show Gist options
  • Save downthecrop/813f87c5237149527f30b44e1301a019 to your computer and use it in GitHub Desktop.
Save downthecrop/813f87c5237149527f30b44e1301a019 to your computer and use it in GitHub Desktop.
get WeGame lol account stats
import requests
import json
rp = requests.post
# URL Constants
get_battle_topbar_info = 'https://m.wegame.com.cn/api/mobile/lua/proxy/index/mwg_lol_proxy/get_battle_topbar_info'
query_by_nick = 'https://m.wegame.com.cn/api/mobile/lua/proxy/index/mwg_lol_proxy/query_by_nick'
c = {
'tgp_id': 'YOUR TGP_ID',
'app_version': '50811',
'mac': 'MAC',
'app_id': '10001',
'account': 'YOUR QQ ACCOUNT ID',
'platform': 'qq',
'client_type': '602',
'machine_type': 'iPhone',
'skey': 'YOUR SKEY',
'channel_number': 'ios',
'tgp_ticket': 'YOUR TICKET',
}
h = {
'User-Agent': 'WeGame/1778 CFNetwork/1121.2.2 Darwin/19.3.0',
'Host': 'm.wegame.com.cn',
'Content-Type': 'application/json',
}
'''
query_by_nick response
{
"msg":"succ",
"code":0,
"data":{
"result":0,
"player_list":[
{
"tgp_id":"xxxxxxxxxxxxxx",
"gender":0,
"game_nick":"xxxxxxxxxxxxxxxxxxx",
"area_id":1,
"slol_id":"xxxxxxxxxxxxxxx",
"icon_url":"http://down.qq.com/qqtalk/lolApp/images/profileIcons/profileicon20.jpg",
"rank_title":""
},
{
"tgp_id":"xxxxxxxxxxxx",
"gender":0,
"game_nick":"xxxxxxxxxxxxxxx",
"area_id":30,
"slol_id":"xxxxxxxxxxxxxxxxx",
"icon_url":"http://down.qq.com/qqtalk/lolApp/images/profileIcons/profileicon29.jpg",
"rank_title":""
}
]
}
}
Note: Still working Dec4 1:11PM with the same key
Note: Still working Dec4 6:17PM with the same key
Note: Web cookies TGP Keys work for authentication
topbar request is what we want for basic info use these params
{
"area_id": 1,
"area_name": "",
"game_id": 26,
"slol_id": "xxxxxxxxxxxxxx"
}
'''
d = '{"search_nick":"downthecrop"}'
response = rp(query_by_nick, headers=h, cookies=c, data=d)
jdata = json.loads(response.text)
print("###########")
print(json.dumps(jdata, indent=4, sort_keys=True))
print("###########")
slol_id = jdata["data"]["player_list"][0]["slol_id"]
print("using "+slol_id)
d = '{"area_id": 1, "area_name": "", "game_id": 26, "slol_id": "'+slol_id+'"}'
response = rp(get_battle_topbar_info, headers=h, cookies=c, data=d)
jdata = json.loads(response.text)
print("###########")
print(json.dumps(jdata, indent=4, sort_keys=True))
print("###########")
@downthecrop
Copy link
Author

@downthecrop
Copy link
Author

If I spoke Chinese I would have been able to just search this up. Still a good learning experience. https://zhuanlan.zhihu.com/p/71549580

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment