[瑪祖採集]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