网址:https://match.yuanrenxue.cn/match/12

接口:https://match.yuanrenxue.cn/api/match/12?page=1

解析流程

抓包,cookie有个字段有加密

image-20230524171922054

发现前面一个包返回的html就是cookie该字段的内容,直接获取到,然后放入请求中就可以获取到了

image-20230524173100652

1
2
3
4
5
6
7
8
9
10
11
12
13
14
requests.utils.add_dict_to_cookiejar(session.cookies, {"sessionid": "zkfllfb1xh7mog7qq3k3759npyuc4shj"})
headers = {
"User-Agent": "yuanrenxue.project",
}

url = "http://match.yuanrenxue.com/match/13"
r = session.get(url)
results = re.findall("'([a-zA-Z0-9=|_])'",r.text)
cookie = ''.join(results)
print(cookie)
key, value = cookie.split('=')
session.cookies.set(key, value)
api_url = 'https://match.yuanrenxue.com/api/match/13?page={}'.format(str(page))
res = session.get(api_url,headers=headers)