标签:turn text i++ res get got awl length pre
地图geojson
http://datav.aliyun.com/tools/atlas/#&lat=33.90689555128866&lng=113.5052490234375&zoom=7
抓取代码
const fetch = require(‘node-fetch‘); var fs = require("fs") async function scrawl(code) { console.log(code + "gotten") if (code % 100 == 0) { let target = code + "_full"; let result = await fetch(`https://geo.datav.aliyun.com/areas_v2/bound/${target}.json`) let text = await result.text() fs.writeFileSync("data/" + target + ".json", text) let json = JSON.parse(text) let features = json.features; for (let i = 0; i < features.length; i++) { let childCode = features[i].properties.adcode await scrawl(childCode) } return; } let result = await fetch(`https://geo.datav.aliyun.com/areas_v2/bound/${code}.json`) let text = await result.text() fs.writeFileSync("data/" + code + ".json", text) } scrawl(100000)
标签:turn text i++ res get got awl length pre
原文地址:https://www.cnblogs.com/windyWu/p/12862717.html