import time import requests import execjs with open("参数加密.js", "r", encoding="utf-8") as f: code_js = f.read() code = execjs.compile(code_js) for page in range(1, 2): temp_params = code.call("beforeSend", page) headers = { "Accept": "application/json, text/javascript, */*; q=0.01", "Accept-Language": "zh-CN,zh;q=0.9", "Connection": "keep-alive", "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "Origin": "https://www.birdreport.cn", "Referer": "https://www.birdreport.cn/", "Sec-Fetch-Dest": "empty", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "same-site", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/152.0.0.0 Safari/537.36", "requestId": str(temp_params["requestId"]), "sec-ch-ua": "\"Chromium\";v=\"152\", \"Not?A_Brand\";v=\"24\", \"Google Chrome\";v=\"152\"", "sec-ch-ua-mobile": "?0", "sec-ch-ua-platform": "\"Windows\"", "sign": str(temp_params["sign"]), "timestamp": str(temp_params["timestamp"]) } enc_data = temp_params["data"] url = 'https://api.birdreport.cn/front/activity/search' response = requests.post(url, headers=headers, data=enc_data) response_json = response.json() result = code.call("aes_decrypt", response_json["data"]) print(result) print(response) time.sleep(1)