|
楼主 |
发表于 2024-9-15 20:39
|
显示全部楼层
用fiddler找到了发送的请求地址,截图红框中的“为你找到17天结果”中的17就是我想要抓的数字,但是为什么下面的代码不能返回包含这个结果的字段呢?
Sub 网抓4()
Dim req As Object
Dim url As String
Dim sText As String
url = "https://www.iwencai.com/customized/chart/get-robot-data"
Set req = CreateObject("WinHttp.WinHttpRequest.5.1")
With req
.Open "POST", url, False
.setRequestHeader "Accept", "application/json, text/plain, */*"
.setRequestHeader "Accept-Language", "zh-CN,zh;q=0.9"
.setRequestHeader "Cache-control", "no-cache"
.setRequestHeader "Connection", "keep-alive"
.setRequestHeader "Content-Type", "application/json"
.setRequestHeader "Cookie", "other_uid=Ths_iwencai_Xuangu_z79bszybmud9ircec4pp1pm0qysarh3u; ta_random_userid=90vkjm3zed; cid=a36570889a6593ceeb8b219cdd7eb5c51724999707; v=A48vs2kFNVcOZTGr_JonETjpHiiItOPWfQjnyqGcK_4FcKHUqYRzJo3YdxCy"
.setRequestHeader "Host", "www.iwencai.com"
.setRequestHeader "Origin", "https://www.iwencai.com"
.setRequestHeader "Pragma", "no-cache"
.setRequestHeader "Referer", "https://www.iwencai.com/unifiedwap/result?w=9:30涨幅大于或等于5%,非北交所&querytype=stock"
.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.95 Safari/537.36"
.setRequestHeader "hexin-V", "AzKSCKTSgJz7arygQS2yas22g3MFwzZdaMcqgfwLXuXQj9wv5FOGbThXepbP"
' JSON payload for the POST request
Dim jsonPayload As String
jsonPayload = ThisWorkbook.Sheets(1).Range("A13").Value
Debug.Print jsonPayload
.Send jsonPayload
sText = .responseText
End With
Debug.Print sText
' 在此处添加处理响应文本 (sText) 的代码
End Sub
其中
下面的请求地址我放在了A13单元格
{"source":"Ths_iwencai_Xuangu","version":"2.0","query_area":"","block_list":"","add_info":"{\"urp\":{\"scene\":1,\"company\":1,\"business\":1},\"contentType\":\"json\",\"searchInfo\":true}","question":"9:30涨幅大于或等于5%,非北交所","perpage":"100","page":1,"secondary_intent":"stock","log_info":"{\"input_type\":\"click\"}","rsh":"Ths_iwencai_Xuangu_77ysuy7dvarvk9q3a874qpm3oqvbrayy"}
VBA返回下面的字段,请高手大神帮忙看看是什么意思,怎么调整程序
{"source":"Ths_iwencai_Xuangu","version":"2.0","query_area":"","block_list":"","add_info":"{\"urp\":{\"scene\":1,\"company\":1,\"business\":1},\"contentType\":\"json\",\"searchInfo\":true}","question":"9:30涨幅大于或等于5%,非北交所","perpage":"100","page":1,"secondary_intent":"stock","log_info":"{\"input_type\":\"click\"}","rsh":"Ths_iwencai_Xuangu_77ysuy7dvarvk9q3a874qpm3oqvbrayy"}
<h1>Nginx forbidden.</h1> <br/>request info: 114.86.130.0
|
-
|