Document the project structure and setup while excluding local dependencies and IDE settings. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
56 lines
1.7 KiB
Python
56 lines
1.7 KiB
Python
import json
|
|
import time
|
|
|
|
import requests
|
|
import execjs
|
|
|
|
headers = {
|
|
"Accept": "application/json, text/plain, */*",
|
|
"Accept-Language": "zh-CN,zh;q=0.9",
|
|
"Authorization": "Bearer false",
|
|
"Connection": "keep-alive",
|
|
"Content-Type": "application/json;charset=UTF-8",
|
|
"Origin": "https://kd.nsfc.cn",
|
|
"Referer": "https://kd.nsfc.cn/finalSearchList?s=%E7%AC%AC%E4%B8%80%E6%80%A7%E5%8E%9F%E7%90%86%E8%AE%A1%E7%AE%97",
|
|
"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/152.0.0.0 Safari/537.36",
|
|
"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\""
|
|
}
|
|
with open("js解密.js", "r", encoding="utf-8") as f:
|
|
js_code = f.read()
|
|
|
|
|
|
ctx = execjs.compile(js_code)
|
|
|
|
url = 'https://kd.nsfc.cn/api/baseQuery/completionQueryResultsData'
|
|
for page in range(1, 11):
|
|
data = {
|
|
"complete": True,
|
|
"fuzzyKeyword": "第一性原理计算",
|
|
"isFuzzySearch": True,
|
|
"conclusionYear": "近五年",
|
|
"dependUnit": "",
|
|
"keywords": "",
|
|
"pageNum": page,
|
|
"pageSize": 10,
|
|
"projectType": "",
|
|
"projectTypeName": "",
|
|
"code": "",
|
|
"ratifyYear": "",
|
|
"order": "enddate",
|
|
"ordering": "desc",
|
|
"codeScreening": "",
|
|
"dependUnitScreening": "",
|
|
"keywordsScreening": "",
|
|
"projectTypeNameScreening": ""
|
|
}
|
|
response = requests.post(url, headers=headers, json=data)
|
|
result = ctx.call("g", response.text)
|
|
print(json.loads(result))
|
|
time.sleep(1)
|
|
|