|
http://www.cwl.gov.cn/cwl_admin/kjxx/findDrawNotice?name=ssq&issueCount=30这个链接Fiddler嗅探出来是有内容的[图1],但是复制到浏览器地址拦访问却是一片空白,所以VBA也不能抓取,需要用什么特殊的方式访问吗?
另一个我成功抓取并用正则处理好了[图2]
- Sub wzdltkj()
- Dim myHTTP As Object, s As String
-
- Set myHTTP = CreateObject("Microsoft.XmlHttp")
- myHTTP.Open "GET", "https://webapi.sporttery.cn/gateway/lottery/getHistoryPageListV1.qry?gameNo=85&provinceId=0&pageSize=30&isVerify=1&pageNo=1&termLimits=30", False
- myHTTP.send
-
- s = myHTTP.responsetext
-
- Dim regex As Object, mches As Object, mch As Object, i&, j&
- Set regex = CreateObject("VBScript.Regexp")
- regex.Global = True
- regex.Pattern = "lotteryDrawNum"":""(\d+?)"",""lotteryDrawResult"":""(\d\d) (\d\d) (\d\d) (\d\d) (\d\d) (\d\d) (\d\d).*?""lotteryDrawTime"":""(\d+-\d+-\d+).*?""stakeAmount"":""([\d|,]+).*?""stakeAmount"":""([\d|,]+).*?""stakeAmount"":""([\d|,]+).*?""stakeAmount"":""([\d|,]+)"
-
- Set mches = regex.Execute(s)
-
- i = 2
- For Each mch In mches
- For j = 0 To 12
- Sheet3.Cells(i, j + 1) = mch.submatches(j)
- Next j
- i = i + 1
- Next mch
- End Sub
复制代码
|
-
Fiddler
-
正则处理后
|