现在用fiddler抓取微信小程序:班级小管家
下面是抓取的内容
其中,第一个文件是我们需要的。
于是,我保存了他的请求内容:
内容如下:
POST https://a.welife001.com/getStudentScoreById HTTP/1.1
Host: a.welife001.com
Connection: keep-alive
Content-Length: 68
x-rid: CB0B9BDE-441F-4FD0-8AD8-78665FD27138
imprint: oWRkU0YSmzvhIyCZK30JJ0L-rVRA
xweb_xhr: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x63090a13) XWEB/9129
Content-Type: application/json;charset=UTF-8
Accept: */*
Sec-Fetch-Site: cross-site
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://servicewechat.com/wx23d8d7ea22039466/2350/page-frame.html
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
{"id":"663090f1c431868bed8d5ebd","preview":false,"name":"高彬翔"}
根据内容,我写了一个python程序来下载:
import requests
url = 'https://a.welife001.com/getStudentScoreById'
headers = {
'x-rid': 'C05879F9-3B3E-4EA3-8B31-EEEF14B73E38',
'imprint': 'oWRkU0YSmzvhIyCZK30JJ0L-rVRA',
'xweb_xhr': '1',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x63090a13) XWEB/8555',
'Content-Type': 'application/json;charset=UTF-8',
'Accept': '*/*',
'Sec-Fetch-Site': 'cross-site',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Dest': 'empty',
'Referer': 'https://servicewechat.com/wx23d8d7ea22039466/2350/page-frame.html',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh;q=0.9'
}
data = {"id": "663090f1c431868bed8d5ebd", "preview": False, "name": "高彬翔"}
response = requests.post(url, headers=headers, json=data)
print(response.text)
但是程序运行后很长一段时间没有反应,之后有报错:
requests.exceptions.ProxyError: HTTPSConnectionPool(host='a.welife001.com', port=443): Max retries exceeded with url: /getStudentScoreById (Caused by ProxyError('Unable to connect to proxy. Your proxy appears to only use HTTP and not HTTPS, try changing your proxy URL to be HTTP. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#https-proxy-error-http-proxy', SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1124)'))))
关闭了证书验证,即verify=False也不行,不知道该怎么办。