进入开发者工具
下面的请求为真实的数据请求
请求方式: GET
参数:m: 16759391|832956713|832956708
---------page : 1
进入ajax调用点
看到m是经过一个fetch请求返回得到的
而fetch请求的是一个wasm文件
wasm文件是经过C/C++/RUST/Go等多种语言编写智能合约并编译成字节码文件
这样我们就无法看懂了
但是python中有第三方库可以对wasm文件进行解析
执行pip install pywasm
那么我们只需要下载请求时的main.wasm文件,然后在python中调用该库来进行调用其中的函数即可
步骤
- 下载请求中的main.wasm文件到本地
- 根据js代码中,获取t1和t2
- 将其传入到exec函数中,获取r进行拼接获取m
- 将m拼接到url中再拼接page即可
代码如下
import math
import random
import time
import pywasm
import requests
runtime = pywasm.load('./main.wasm')
t1 = int(int(time.time()) / 2)
t2 = int(int(time.time()) / 2 - math.floor(random.random() * (50) + 1))
r = runtime.exec('encode', [t1, t2])
m = str(r) + '|' + str(t1) + "|" + str(t2)
headers = {
'Host': 'match.yuanrenxue.com',
'Connection': 'keep-alive',
'sec-ch-ua': '"Chromium";v="106", "Microsoft Edge";v="106", "Not;A=Brand";v="99"',
'Accept': 'application/json, text/javascript, */*; q=0.01',
'X-Requested-With': 'XMLHttpRequest',
'sec-ch-ua-mobile': '?0',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.42',
'sec-ch-ua-platform': '"Windows"',
'Sec-Fetch-Site': 'same-origin',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Dest': 'empty',
'Referer': 'https://match.yuanrenxue.com/match/15',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
'Cookie': 'sessionid=cr0bsa62pjo8ge174tj1usxnfcik8cpa; Hm_lvt_c99546cf032aaa5a679230de9a95c7db=1665887019,1665888460,1665900743; qpfccr=true; no-alert3=true; Hm_lvt_9bcbda9cbf86757998a2339a0437208e=1665887019,1665888460,1665900743; tk=-1215616161085909768; yuanrenxue_cookie=1665910110|tAKJa7TEyZEZRPzVqqfpMGFYiT6mmL4gcYbHcjy6kmCoBjzmpqkwzvwr; Hm_lpvt_9bcbda9cbf86757998a2339a0437208e=1665911138; Hm_lpvt_c99546cf032aaa5a679230de9a95c7db=1665912173',
}
res = 0
for page in range(1, 6):
if page > 3:
headers['User-Agent'] = 'yuanrenxue.project'
url = 'https://match.yuanrenxue.com/api/match/15?m={}&page={}'.format(m, page)
response = requests.get(url, headers=headers)
datas = response.json()['data']
for data in datas:
res += data['value']
print(res)