【猿人学】web第一届 第19题 乌拉乌拉

查看接口

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)

结果:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

我写的代码全是bug

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值