查看接口
curl_cffi 通过 impersonate="chrome110"
克隆了 Chrome 的 TLS 指纹,让服务器“看不出”这是程序在发请求。
response = requests.get(url, headers=headers, cookies=cookies, params=params, impersonate="chrome110", verify=False)
结果:
方法二:
import json
import requests
#
# js = open('demo.js').read()
#
# import time
#
# times = int(time.time()) * 1000
#
# m = execjs.compile(js).call('ff', str(times))
# print(m)
headers = {
"authority": "match.yuanrenxue.cn",
"method": "GET",
"path": "/api/match/19",
"scheme": "https",
"accept": "application/json, text/javascript, */*; q=0.01",
"accept-encoding": "gzip, deflate, br, zstd",
"accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
"cache-control": "no-cache",
"cookie": "Hm_lvt_434c501fe98c1a8ec74b813751d4e3e3=1755865381; HMACCOUNT=17EE3095C9850A32; Hm_lpvt_434c501fe98c1a8ec74b813751d4e3e3=1755871738; sessionid=bse1j3p3uluqpc3jod0t5zrjs84ht1hc; qpfccr=true; no-alert3=true; tk=-7670778819243019963",
"pragma": "no-cache",
"priority": "u=0, i",
"referer": "https://match.yuanrenxue.cn/match/19",
"sec-ch-ua": "\"Google Chrome\";v=\"131\", \"Chromium\";v=\"131\", \"Not_A Brand\";v=\"24\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
"x-requested-with": "XMLHttpRequest",
}
sum = 0
for i in range(1, 6):
params = {
('page', i)
}
response = requests.get(url='https://match.yuanrenxue.cn/api/match/19', headers=headers, params=params)
json_data = json.loads(response.text)
print(json.dumps(json_data, indent=4, ensure_ascii=False))
for i in json_data['data']:
sum += i['value']
print(sum)
结果: