獲取上海鏈家二手房掛牌數(shù)量的腳本
const https = require('https');
https.get('https://map.ke.com/proxyApi/i.c-pc-webapi.ke.com/map/bubblelist?cityId=310000&dataSource=ESF&condition=&id=&groupType=district&maxLatitude=31.681833328321947&minLatitude=31.317290433641848&maxLongitude=122.22462814890648&minLongitude=120.51482937343484',(res)=>{
let data = ''
res.on('data',(chunk)=>{
data += chunk;
})
res.on('end',()=>{
let bubbleList = JSON.parse(data)['data']['bubbleList'];
let count = 0;
for(value in bubbleList){
count = count + bubbleList[value]['count'];
}
console.log("total === " + count);
})
})
/**
* 獲取鏈家上海二手房掛牌數(shù)量的腳本
* 由于用到了 https,所以第一次使用的時(shí)候需要先執(zhí)行 npm install https --save 進(jìn)行安裝 https
* 安裝完 https 后,就可以在 house.js 文件所在的目錄執(zhí)行 node house.js 運(yùn)行腳本
*/