[玛祖采集]python爬虫实践 采集高德地图上的位置 店铺信息 导出excel表格python
1、环境 OS:win10 python:3.7git
用到的库github
from urllib.parse import quote from urllib import request import json import xlwt import sys
预先申请高德地图API
先上效果图
采集到店铺的位置 名称web
代码部分解释json
poi_search_url = "http://restapi.amap.com/v3/place/text" poi_boundary_url = "https://ditu.amap.com/detail/get/detail"
搜索用api连接凭借api
def getpoi_page(cityname, keywords, page): req_url = poi_search_url + "?key=" + amap_web_key + '&extensions=all&keywords=' + quote( keywords) + '&city=' + quote(cityname) + '&citylimit=true' + '&offset=25' + '&page=' + str( page) + '&output=json' data = '' with request.urlopen(req_url) as f: data = f.read() data = data.decode('utf-8') return data
加好友请备注 数据
VX: umakedown
github: https://github.com/ChanJeff123python爬虫
转载注明出处[玛祖采集]url