vba xmlhttp 抓取网页(从我一直使用的:我正在寻找一种方法来抓取网页2)
优采云 发布时间: 2021-09-24 04:09vba xmlhttp 抓取网页(从我一直使用的:我正在寻找一种方法来抓取网页2)
从我一直在使用的:
Url$ = "www.somewebpage.com"
Dim Http As New XMLHTTP60, worldData As Object, S$
With Http
.Open "GET", Url, False
.send
S = .responseText
End With
1)我正在寻找一种抓取网页的方法2)从第一个节点的javascript(请注意javascripts可能实际上并不存在)寻找一种从网页抓取数据数组的方法((如图所示)下面)方法,然后是节点内第一个值的坐标......我想返回下面的例子。我将如何开始:
With CreateObject("VBScript.RegExp")
.Pattern = "?????"
Set worldData = .Execute(S)
If worldData.Count > 0 Then
'here to loop and create/assing into arrays
End If
End With
网页上的数据:
var g_mapperData = {
40: {
'0': {
count: 3,
coords: [
[45.2,69.9,{label:'$2$1
Respawn: 2min
Phase: 1
$3',type: '0'}],
[45.5,69.5,{label:'$2$1
Respawn: 2min
Phase: 1
$3',type: '0'}],
[44.8,68,{label:'$2$1
Respawn: 2min
Phase: 1
$3',type: '0'}]
]
}
},
12: {
'0': {
count: 1,
coords: [
[48.4,86.61,{label:'$2$1
Respawn: 2min
Phase: 1
$3',type: '0'}]
]
}
},
3524: {
'0': {
count: 2,
coords: [
[48.2,70.9,{label:'$2$1
Respawn: 2min
Phase: 1
$3',type: '0'}],
[46.1,70.7,{label:'$2$1
Respawn: 2min
Phase: 1
$3',type: '0'}]
]
}
}
};
数组的预期结果:
MapID = {40, 12, 3524}
Xcoord = {45.2, 48.4, 48.2}
Ycoord = {69.9, 86.61, 70.9}
每个数组应该始终具有相同的值长度,因为每个“MapID”中至少有一个 X/Y 记录(可以更多,甚至多达数百个),而 MapID 可以只有一个甚至数百个。
谢谢巫师的魔法