本帖最后由 hxs1 于 2023-1-3 11:59 编辑
这是猿人学第20题的,这个是加密参数吧?"D#uqGdcw41pWeNXm",但是在sign加密位置那里没有找到这个呢?哪位大佬能解释下,谢谢
[Python] 纯文本查看 复制代码 import re
import time
import requests
import hashlib
headers = {
"user-agent": "yuanrenxue,project"
}
cookies = {
"sessionid": " your sessionid "
}
url = "https://match.yuanrenxue.com/api/match/20"
def main():
num_add_total = 0
for page_num in range(1, 6):
timestamp = str(int(time.time() * 1000))
sign = hashlib.md5((str(page_num) + "|" + timestamp + "D#uqGdcw41pWeNXm").encode()).hexdigest()
params = {
"page": page_num,
"sign": sign,
"t": timestamp
}
response = requests.get(url, headers=headers, cookies=cookies,
params=params)
num_add = 0
for i in range(10):
value = response.json()['data'][i]
num = re.findall(r"'value': (.*?)}", str(value))[0]
num_add += int(num)
num_add_total += num_add
print(num_add_total)
if __name__ == '__main__':
main() |