|
楼主 |
发表于 2021-2-11 12:11
|
显示全部楼层
放出全部代码:
- Sub wzssqkj()
- Dim myHTTP As Object, s As String
-
- 'Set myHTTP = CreateObject("Microsoft.XmlHttp")
- 'myHTTP.Open "GET", "http://datachart.500.com/ssq/history/newinc/history.php?limit=30&sort=0", False
- 'myHTTP.send
- Set myHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
- With myHTTP
- .Open "GET", "http://www.cwl.gov.cn/cwl_admin/kjxx/findDrawNotice?name=ssq&issueCount=30", False
- .setRequestHeader "Host", "www.cwl.gov.cn"
- .setRequestHeader "Connection", "keep-alive"
- .setRequestHeader "Upgrade-Insecure-Requests", "1"
- .setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3861.400 QQBrowser/10.7.4313.400"
- .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
- .setRequestHeader "Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
- .setRequestHeader "Referer", "http://club.excelhome.net/thread-1575009-1-1.html"
- .setRequestHeader "Accept-Encoding", "gzip, deflate"
- .setRequestHeader "Accept-Language", "zh-CN,zh;q=0.9"
- .setRequestHeader "Cookie", "_ga=GA1.3.1058570018.1612955503; _gid=GA1.3.1852979334.1612955503; 21_vq=26"
- .send
- End With
-
- 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 = "code"":""(\d+).*?date"":""(.*?)"".*?(\d\d),(\d\d),(\d\d),(\d\d),(\d\d),(\d\d)"".*?(\d\d).*?typemoney"":""(\d+).*?typemoney"":""(\d+)"
-
- Set mches = regex.Execute(s)
-
- i = 2
- For Each mch In mches
- For j = 0 To 10
- Sheet7.Cells(i, j + 1) = mch.submatches(j)
- Next j
- i = i + 1
- Next mch
- End Sub
复制代码 |
|