Files
sycm/get_data.py
T
2023-11-01 13:49:53 +08:00

30 lines
715 B
Python

import http.client
import json
def get_data(raw_data=[100, 101]):
conn = http.client.HTTPSConnection("www.zhishuyao.com")
payload = "type=jyzs"
for item in raw_data:
payload += f"&val[]={item}"
headers = {
"authority": "www.zhishuyao.com",
"content-type": "application/x-www-form-urlencoded",
"origin": "https://www.zhishuyao.com",
}
conn.request("POST", "/decode.php", payload, headers)
res = conn.getresponse()
data = res.read()
return json.loads(data.decode("utf-8"))["data"]
if __name__ == "__main__":
raw_data = list(range(0, 1001, 20))
res = get_data(raw_data)
for raw, new in zip(raw_data, res):
print(raw, new)