This commit is contained in:
2022-07-20 16:45:20 +08:00
parent 62d9fd7940
commit f745492d81
2 changed files with 41 additions and 2 deletions
@@ -29,9 +29,9 @@ public class ExportNearestAvgPrice {
static main(args) {
def citys = ["苏州"]//findAllCity();
def citys = ["重庆"]//findAllCity();
def task = new ExportNearestAvgPrice();
def weekends = task.findWeekends(34);//日期最近的X期
def weekends = task.findWeekends(12);//日期最近的X期
// task.exportAllCity(citys, weekends, "e:\\全国城市均价.csv");
task.exportRegion(citys, weekends, "D:\\数据\\区域均价.csv");
@@ -0,0 +1,39 @@
package com.fangjia.script.gj.crawl
import com.fangjia.script.util.ABuYunUtil
import com.fangjia.script.util.ExcelUtils
import net.sf.json.JSONObject
class AnjukeDistSearch {
static main(args) {
def task = new AnjukeDistSearch()
task.run()
}
def run(){
def file = "D:\\Êý¾Ý\\Ë·ÖÝÆ¥Åä·¿Ô´1.xlsx"
ExcelUtils.modify(file,{d->
def data = getDataInfo(282, d['C'])
if(data){
def match = data.match
if(match){
println match
}
}
})
getDataInfo()
}
def getDataInfo(cityId, keyword){
def url = "https://m.anjuke.com/ajax/autocomplete/?city_id=282&kw="+URLEncoder.encode(keyword, "utf-8")
def ret = ABuYunUtil.doGet(url, null, null, "utf-8")
if (ret) {
JSONObject jsonObj = JSONObject.fromObject(ret);
if (jsonObj && jsonObj.msg == "ok") {
def data = jsonObj.data
return data
}
}
return null
}
}