|
Sub baiduMap()
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 15
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=176"
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 & "&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
大神给看看,为什么只能返回15页,不然就会报错 |
|