private static int GetHousePrice(DoubanHouse house) { var price = JiebaTools.GetHousePrice(house.Title); if (price == 0 && !string.IsNullOrEmpty(house.Text)) { price = JiebaTools.GetHousePrice(house.Text); } return(price); }
private static string GetGeoText(DoubanHouse h) { var text = RemoveImgLabels(h.Text, h.Pictures.Count); if (string.IsNullOrEmpty(text) || text.Contains("www.douban.com")) { text = h.Title; } text = Tools.RemoveSpecialCharacter(text.Replace("\n", "").Replace("|", "").Trim()); if (text.Count() >= 100) { return(text.Substring(0, 100)); } return(text); }
private static void FillHousePriceAndText(DoubanHouse house, JToken geocode) { if (geocode["location"].ToString().Split(",").Count() == 2) { house.Longitude = geocode["location"].ToString().Split(",")[0]; house.Latitude = geocode["location"].ToString().Split(",")[1]; house.Location = geocode["formatted_address"].ToString(); house.Tags = geocode["district"].ToString(); } house.Text = RemoveImgLabels(house.Text, house.Pictures.Count); house.Price = GetHousePrice(house); house.UpdateTime = DateTime.Now; if (geocode["location"].ToString().Split(",").Count() < 2 && house.Price == 0) { house.Status = (int)HouseStatusEnum.Deleted; } }
private static string GetGeoText(DoubanHouse h) { var text = ""; if (!string.IsNullOrEmpty(h.Text) && !h.Text.Contains("www.douban.com")) { text = RemoveImgLabels(h.Text, h.Pictures.Count); if (string.IsNullOrEmpty(text)) { text = h.Title; } } else { text = h.Title; } text = text.Replace("\n", "").Replace("|", ""); if (text.Count() >= 100) { return(text.Substring(0, 100)); } return(text); }
private static void FillHouseLocation(DoubanHouse house, JToken geocode) { if (geocode["location"].ToString().Split(",").Count() == 2) { house.Longitude = geocode["location"].ToString().Split(",")[0]; house.Latitude = geocode["location"].ToString().Split(",")[1]; house.Location = geocode["formatted_address"].ToString(); house.Tags = geocode["district"].ToString(); house.Status = (int)HouseStatusEnum.Analyzed; } else if (geocode["location"].ToString().Split(",").Count() < 2) { if (house.Price == 0) { house.Status = (int)HouseStatusEnum.Deleted; } else { house.Status = (int)HouseStatusEnum.Analyzed; } } house.UpdateTime = DateTime.Now; }