|
菜鸟求高手赐教网页抓数据(脚本怎样改)?
以下网址:
http://dcfm.eastmoney.com/em_mut ... p;ps=22&filter=(TRADECODE=%27002915%27)&st=TRADEDATE&sr=-1&callback=&_=1609143096572
Sub 个股()
Dim url As String
Dim xmlhttp As Object
Dim json As Object
Dim arr(1 To 22, 1 To 14)
Dim item, data
Dim i As Integer
Set xmlhttp = CreateObject("msxml2.xmlhttp")
With xmlhttp
.Open "GET", "http://dcfm.eastmoney.com/em_mutisvcexpandinterface/api/js/get?type=QGQP_LSJGCYD&token=70f12f2f4f091e459a279469fe49eca5&ps=22&filter=(TRADECODE=%27002915%27)&st=TRADEDATE&sr=-1&callback=&_=1609143096572", False
.Send
With CreateObject("msscriptcontrol.scriptcontrol")
.Language = "jscript"
.AddCode "var data=" & xmlhttp.responseText
Set json = .codeobject.data
End With
For Each item In json.data
i = i + 1
With item
arr(i, 1) = .TRADECODE
arr(i, 2) = .STOCKNAME
arr(i, 3) = .PCTBUYXL
arr(i, 4) = .PCTBUYL
arr(i, 5) = .ZB
arr(i, 6) = .ZB3RAVG
arr(i, 7) = .ZB50RAVG
arr(i, 8) = .JGCYD
arr(i, 9) = .FLOWINXL
arr(i, 10) = .FLOWOUTX
arr(i, 11) = .FLOWINL
arr(i, 12) = .FLOWOUTL
arr(i, 13) = .ZLJLR
arr(i, 14) = .TRADEDATE
End With
Next item
End With
[a2].Resize(22, 14) = arr
End Sub |
|