|
VBA万岁 发表于 2014-10-6 15:33
suwenkai老师,以上1039个城市的id值是如何得到的?
以下代码可以提取到 ID与城市对应该表。- Sub 按钮12_单击()
- Dim url, html, js
- Cells.ClearContents
- Set html = CreateObject("htmlfile")
- Set js = CreateObject("scriptcontrol")
- js.Language = "jscript"
- For p = 1 To 5000 '自己自行修改要查找对应的ID
- 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=" & p
- url = url & "&pl_data_type=cater"
- url = url & "&pl_sub_type=餐饮"
- 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=0"
- url = url & "&tn=B_NORMAL_MAP"
- url = url & "&ie=utf-8"
- url = url & "&t=1412423900383"
- .Open "get", url, False
- .send
- js.addcode ("suwenkai = " & .responsetext)
- n = n + 1
- Cells(n, 1) = js.eval("suwenkai.current_city.code")
- Cells(n, 2) = js.eval("suwenkai.current_city.name")
- End With
- Next
- End Sub
复制代码 |
评分
-
3
查看全部评分
-
|