Document the project structure and setup while excluding local dependencies and IDE settings. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
import requests
|
|
import execjs
|
|
import time
|
|
|
|
headers = {
|
|
"Accept": "application/json, text/plain, */*",
|
|
"Accept-Language": "zh-CN,zh;q=0.9",
|
|
"Connection": "keep-alive",
|
|
"Referer": "https://jzsc.mohurd.gov.cn/data/company",
|
|
"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",
|
|
"accessToken;": "",
|
|
"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\"",
|
|
"timeout": "30000",
|
|
"v": "231012"
|
|
}
|
|
|
|
with open("js解密.js", "r", encoding="utf-8") as f:
|
|
js_code = f.read()
|
|
|
|
code = execjs.compile(js_code)
|
|
url = 'https://jzsc.mohurd.gov.cn/APi/webApi/dataservice/query/comp/list'
|
|
for page in range(1, 11):
|
|
params = {
|
|
"pg": str(page),
|
|
"pgsz": "15",
|
|
"total": "450"
|
|
}
|
|
response = requests.get(url, headers=headers, params=params)
|
|
# print(response.text)
|
|
result = code.call("g", response.text)
|
|
print(result)
|
|
time.sleep(1) |