码迷,mamicode.com
首页 > 其他好文 > 详细

怎么把百度地图的搜索结果全部导出到Excel文件

时间:2016-05-05 16:01:49      阅读:954      评论:0      收藏:0      [点我收藏+]

标签:

我想把百度地图搜索结果导出文件,例如:百度地图里搜索“餐饮”,区域是全北京地区,要“名称”“电话”“地址”,怎么把搜索的结果直接导成文件,望大神指导。

Sub 按钮1_单击()
    Dim url, html, js
    Cells.ClearContents
    br = [{"店名","地址","电话"}]
    Range("a1:c1") = br
    url = ""
    Set html = CreateObject("htmlfile")
    Set js = CreateObject("scriptcontrol")
    js.Language = "jscript"
    For p = 1 To 5
        With CreateObject("msxml2.xmlhttp")
            url = "http://map.baidu.com/?newmap=1"
            url = url & "&reqflag=pcmap"
            url = url & "&biz=1"
            url = url & "&from=webmap"
            url = url & "&qt=s"
            url = url & "&from=webmap"
            url = url & "&c=131"
            url = url & "&pl_data_type=cater"
            url = url & "&pl_sub_type=%E9%A4%90%E9%A6%86"
            url = url & "&pl_price_section=0%2C%2B"
            url = url & "&pl_sort_type=data_type"
            url = url & "&pl_sort_rule=0"
            url = url & "&pl_discount2_section=0%2C%2B"
            url = url & "&pl_groupon_section=0%2C%2B"
            url = url & "&pl_cater_book_pc_section=0%2C%2B"
            url = url & "&pl_ticket_book_flag_section=0%2C%2B"
            url = url & "&pl_movie_book_section=0%2C%2B"
            url = url & "&pl_business_type=cater"
            url = url & "&pl_business_id="
            url = url & "&pl_activity_gwj_section=0%2C%2B"
            url = url & "&wd=餐饮"
            url = url & "&pn=1"
            url = url & "&db=0"
            url = url & "&wd2="
            url = url & "&sug=0"
            url = url & "&da_src=pcmappg.poi.page"
            url = url & "&on_gel=1"
            url = url & "&src=7"
            url = url & "&gr=3"
            url = url & "&b=(12923312.96,4835667.72;12993008.96,4846291.72)"
            url = url & "&l=12"
            url = url & "&addr=0"
            url = url & "&nn=" & (p - 1) * 10
            url = url & "&tn=B_NORMAL_MAP"
            url = url & "&ie=utf-8"
            url = url & "&t=1412423900383"
            .Open "get", url, False
            .send
            js.addcode ("suwenkai = " & .responsetext)

            slen = js.eval("suwenkai.content.length") - 1
            For i = 0 To slen
                n = n + 1
                Cells(n + 1, 1) = js.eval("suwenkai.content[" & i & "].name")
                Cells(n + 1, 2) = js.eval("suwenkai.content[" & i & "].addr")
                Cells(n + 1, 3) = js.eval("suwenkai.content[" & i & "].tel")
            Next
        End With
    Next
End Sub

 

怎么把百度地图的搜索结果全部导出到Excel文件

标签:

原文地址:http://www.cnblogs.com/xiamidong/p/5462063.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!