上海链家二手房挂牌数量脚本

2023-10-08  本文已影响0人  张_何

获取上海链家二手房挂牌数量的脚本

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);
    })
})
/**
 * 获取链家上海二手房挂牌数量的脚本
 * 由于用到了 https,所以第一次使用的时候需要先执行 npm install https --save 进行安装 https
 * 安装完 https 后,就可以在 house.js 文件所在的目录执行 node house.js 运行脚本
 */
上一篇 下一篇

猜你喜欢

热点阅读