【问题标题】:VBA Webscraping, taking data from a script tagVBA Webscraping,从脚本标签中获取数据
【发布时间】:2015-04-27 08:17:34
【问题描述】:

我一直在构建一个抓取工具,我已经设法将我需要的大部分信息抓取到一个 Excel 表格中,其中一条信息给我带来了问题,因为它位于一段我不熟悉抓取的 HTML 中。

<script type="text/javascript">
    var mapOptions = {
        property: {
            PropertyID: 1234567,
            Address: "Address, Address, Address",
            Price: "€100,000",
            Map: {"Latitude":00.0000000,"Longitude":00.0000000,"Accuracy":2,"IsAutoGeocoded":true,"Polygons":[]},
            MainPhotoUrl: "//photo.jpg",
            PropertySection: 1
        },
        propertySection: "residential",
        baseUrl: "",
        useOpenLayer: false,
        zoom: 15
    };
</script>

我正在尝试从这个脚本中刮出经纬度,知道怎么做吗?

【问题讨论】:

    标签: javascript html excel vba web


    【解决方案1】:

    你可以试试这个,它可能不是最干净的方法,但它应该可以工作,你只需将其转换为数值供以后使用:

    Sub tez()
    Dim Src As String
    Src = "___________Latitude_:03.0000080,_Longitude_:05.0000070,_"
    
    Dim LatD As String
    Dim LonD As String
    
    LatD = GetInfo(Src, "Latitude")
    LonD = GetInfo(Src, "Longitude")
    
    MsgBox LatD & Chr(13) & LonD
    End Sub
    
    Public Function GetInfo(ByVal Str_D As String, ByVal Info_To_Get As String) As String
    Dim AddressInfo As Double
    AddressInfo = InStr(1, Str_D, Info_To_Get) + Len(Info_To_Get) + 2
    
    GetInfo = Mid(Str_D, AddressInfo, InStr(AddressInfo, Str_D, ",") - AddressInfo)
    
    End Function
    

    【讨论】:

      猜你喜欢
      • 2020-06-18
      • 2021-01-09
      • 2021-12-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多