|
楼主 |
发表于 2017-10-22 18:37
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
老师,这个程序也遇到相同问题,就是除了10月份,其他月份都不能抓取,谢谢老师能看看嘛?
Sub 金融界() 'yzc51
Dim arr(1 To 10000, 1 To 19), aa, i
[a2:L500] = ""
URL = "http://stock.jrj.com.cn/action/getTzrlData.jspa"
Application.ScreenUpdating = 0
' URL = "C:\getTzrlData_jspa.txt"
With CreateObject("Msxml2.XMLHTTP")
.Open "GET", URL, 0
.send
aa = Replace(Replace(.responsetext, Chr(9), ""), " ", "")
End With
mm = Len(aa) - Len(Replace(aa, "date", ""))
mm = mm / 4
For i = 1 To mm
r = r + 1
arr(r, 1) = r
arr(r, 2) = Split(Split(aa, "date"":""")(i), """,")(0)
mu = "events" & Split(Split(aa, "events")(i), "{""date")(0)
mu1 = Len(mu) - Len(Replace(mu, "level", ""))
mu1 = mu1 / 5
'Debug.Print mu
For j = 1 To mu1
arr(r, 3) = Split(Split(mu, "title"":""")(j), """,")(0)
YZC = Split(Split(mu, "level"":""")(j), """,")(0)
arr(r, 4) = Mid("★★★★★", 1, YZC) & Mid("☆☆☆☆☆", 1, 5 - YZC)
mu2 = "concepts" & Split(Split(aa, "concepts")(r), "{""date")(0)
mu21 = Len(mu2) - Len(Replace(mu2, "code", ""))
mu21 = mu21 / 4
'Debug.Print mu2
tmp = "": tmp1 = "": tmp2 = "": tmp3 = "": tmp4 = "": tmp30 = "": tmp31 = "": tmp32 = ""
For k = 1 To mu21
tmp = tmp & Chr(10) & Split(Split(mu2, "code"":""")(k), """,")(0)
'arr(r, 6) = Mid(tmp, 2)
tmp1 = tmp1 & " " & Split(Split(mu2, "name"":""")(k), """,")(0)
arr(r, 5) = Mid(tmp1, 2)
tmp2 = tmp2 & Chr(10) & Split(Split(mu2, "pl"":""")(k), """,")(0)
'arr(r, 6) = Mid(tmp2, 2)
tmp3 = tmp3 & " |" & Split(Split(mu2, "stocks"":""")(k), """")(0)
tmp30 = tmp30 & " '" & Left(Split(Split(mu2, "stocks"":""")(k), """")(0), 6)
arr(r, 6) = "'" & Mid(tmp30, 2)
tmp31 = tmp31 & " '" & Mid(Split(Split(mu2, "stocks"":""")(k), """")(0), 8, 6)
arr(r, 8) = "'" & Mid(tmp31, 2)
tmp32 = tmp32 & " '" & Mid(Split(Split(mu2, "stocks"":""")(k), """")(0), 15, 6)
arr(r, 10) = "'" & Mid(tmp32, 2)
arr(r, 12) = Mid(tmp3, 2, 911) ': Left(tmp3 = ""
Next
tmp4 = Left(Replace(Mid(tmp3, 4), ",", "|"), 20)
tmp5 = Mid(InStr(tmp3, Chr(10)), 20)
tmp6 = Left(Split(Chr(10) & tmp3, Chr(10))(1), 20)
r = r + 1
Next
r = r - 1
Next
Range("a2").Resize(r + 1, 16) = arr
fh
[G2:G500] = "=IF(F2="""","""",VLOOKUP(F2,GPDM,2,1))"
[I2:I500] = "=IF(H2="""","""",VLOOKUP(H2,GPDM,2,1))"
[K2:K500] = "=IF(J2="""","""",VLOOKUP(J2,GPDM,2,1))"
yzc51
Range("l19").Select
Application.ScreenUpdating = True
'分列数据竖号
End Sub 'http://stock.jrj.com.cn/tzrl/ |
|