public static ImportedHouse GetShopInfo(string html, ImportedHouse house) { /* * setShop('商业街商铺','闲置中', * '百货超市,家居建材,服饰鞋包,生活服务,美容美发,餐饮美食,休闲娱乐,其他','1','1','客梯,货梯,扶梯,空调,水','元/月'); * function setShop(shopType,shopStatus,targetField,hasFee,divide,basicEquip,priceType) */ Match houseRegex = new Regex( "setShop\\('(?<shopType>.*?)','(?<shopStatus>.*?)'," + "'(?<targetField>.*?)','(?<hasFee>.*?)','(?<divide>.*?)','(?<basicEquip>.*?)','(?<priceType>.*?)'") .Match(html.Trim().Replace("\r", "").Replace("\n", "").Replace("\t", "").Replace("\t", "")); string shopType = houseRegex.Groups["shopType"].Value; string shopStatus = houseRegex.Groups["shopStatus"].Value; string basicEquip = houseRegex.Groups["basicEquip"].Value; string divide = houseRegex.Groups["divide"].Value; string targetField = houseRegex.Groups["targetField"].Value; string hasFee = houseRegex.Groups["hasFee"].Value; house.shopInfo = new ShopInfo { ShopType = shopType, ShopStatus = shopStatus, BasicEquip = basicEquip, Divide = (divide == "1"), TargetField = targetField, Fee = decimal.Parse(hasFee) }; return(house); }
public static ImportedHouse GetOfficeInfo(string html, ImportedHouse house) { //function setOffice(officeType,officeLeve,hasFee,divide,basicEquip,priceType) //setOffice('纯写字楼','甲级','0', // '1','水,电,煤气/天然气,暖气,电梯,车位,露台,阁楼,电话,彩电,热水器,洗衣机,冰箱,空调,家具,宽带网','万'); Match houseRegex = new Regex( "setOffice\\('(?<officeType>.*?)','(?<officeLeve>.*?)','(?<hasFee>\\d+)'," + "'(?<divide>.*?)','(?<basicEquip>.*?)','(?<priceType>.*?)'").Match( html.Trim().Replace("\r", "").Replace("\n", "").Replace("\t", "")); string officeType = houseRegex.Groups["officeType"].Value; string officeLeve = houseRegex.Groups["officeLeve"].Value; string hasFee = houseRegex.Groups["hasFee"].Value; string divide = houseRegex.Groups["divide"].Value; string basicEquip = houseRegex.Groups["basicEquip"].Value; // string priceType = houseRegex.Groups["priceType"].Value; house.officeInfo = new OfficeInfo { OfficeType = officeType, OfficeLevel = officeLeve, BasicEquip = basicEquip, Divide = (divide == "1"), Fee = decimal.Parse(hasFee) }; return(house); }
public static ImportedHouse GetVillaInfo(string html, ImportedHouse house) { /* * * * setVilla('独栋','平层', * '7','3','4','1','4', * '0','0','0','0','水,电,煤气/天然气,电梯,露台,阁楼,电话', * '水,电,煤气/天然气,电梯,露台,阁楼,电话','70年产权','1','0'); * function setVilla(villaType,hallType,room,hall,toilet,kitchen,balcony, * basement,garden,garage,parkLot,basicEquip,advEquip,landYear,fiveYears,onlyHouse) */ Match villaRegex = new Regex( "setVilla\\('(?<villaType>.*?)','(?<hallType>.*?)'," + "'(?<room>\\d+)','(?<hall>\\d+)','(?<toilet>\\d+)','(?<kitchen>\\d+)','(?<balcony>\\d+)'," + "'(?<basement>.*?)','(?<garden>.*?)','(?<garage>.*?)','(?<parkLot>.*?)','(?<basicEquip>.*?)'," + "'(?<advEquip>.*?)','(?<landYear>.*?)','(?<fiveYears>.*?)','(?<onlyHouse>.*?)'").Match( html.Trim().Replace("\r", "").Replace("\n", "").Replace("\t", "")); string villaType = villaRegex.Groups["villaType"].Value; string hallType = villaRegex.Groups["hallType"].Value; string basement = villaRegex.Groups["basement"].Value; string garden = villaRegex.Groups["garden"].Value; string garage = villaRegex.Groups["garage"].Value; string parkLot = villaRegex.Groups["parkLot"].Value; string basicEquip = villaRegex.Groups["basicEquip"].Value; string advEquip = villaRegex.Groups["advEquip"].Value; string landYear = villaRegex.Groups["landYear"].Value; string fiveYears = villaRegex.Groups["fiveYears"].Value; string onlyHouse = villaRegex.Groups["onlyHouse"].Value; string balcony = villaRegex.Groups["balcony"].Value; string toilet = villaRegex.Groups["toilet"].Value; string kitchen = villaRegex.Groups["kitchen"].Value; string hall = villaRegex.Groups["hall"].Value; string room = villaRegex.Groups["room"].Value; house.Balcony = byteParse(balcony); house.Toilet = byteParse(toilet); house.Kitchen = byteParse(kitchen); house.Room = byteParse(room); house.Hall = byteParse(hall); house.villaInfo = new VillaInfo { AdvEquip = advEquip, BasicEquip = basicEquip, FiveYears = (fiveYears == "1"), OnlyHouse = (onlyHouse == "1"), LandYear = landYear, Garage = (garage == "1"), Garden = (garden == "1"), Basement = (basement == "1"), ParkLot = (parkLot == "1"), HallType = hallType, VillaType = villaType, // HouseStructure = houseStructure }; return(house); }
public static ImportedHouse GetHouseInfo(string html, ImportedHouse house) { /* * setHouse(houseType,room,hall,toilet,kitchen,balcony,advEquip,houseSubType, * houseProperty,landYear,houseStructure,fiveYears,basicEquip,onlyHouse) * * setHouse( * '普通住宅','3','1','1','1','1', * '电话,热水器,彩电,空调,冰箱,洗衣机,家具,床,宽带网,微波炉,衣柜,沙发,厨具,独立卫生间,水,电,煤气/天然气,有线电视','多层[1-7层]','商品房','70年产权','板楼', * '1','水,电,煤气/天然气,有线电视,电话,热水器,彩电,空调,冰箱,洗衣机,家具,床,宽带网,微波炉,衣柜,沙发,厨具,独立卫生间','1'); */ Match houseRegex = new Regex( "setHouse\\('(?<houseType>.*?)','(?<room>\\d+)','(?<hall>\\d+)'" + ",'(?<toilet>\\d+)','(?<kitchen>\\d+)','(?<balcony>\\d+)'," + "'(?<advEquip>.*?)','(?<houseSubType>.*?)','(?<houseProperty>.*?)','(?<landYear>.*?)','(?<houseStructure>.*?)'," + "'(?<fiveYears>.*?)','(?<basicEquip>.*?)','(?<onlyHouse>.*?)'").Match( html.Trim().Replace("\r", "").Replace("\n", "").Replace("\t", "")); string houseType = houseRegex.Groups["houseType"].Value; string advEquip = houseRegex.Groups["advEquip"].Value; string houseSubType = houseRegex.Groups["houseSubType"].Value; string houseProperty = houseRegex.Groups["houseProperty"].Value; string landYear = houseRegex.Groups["landYear"].Value; string houseStructure = houseRegex.Groups["houseStructure"].Value; string fiveYears = houseRegex.Groups["fiveYears"].Value; string basicEquip = houseRegex.Groups["basicEquip"].Value; string onlyHouse = houseRegex.Groups["onlyHouse"].Value; string balcony = houseRegex.Groups["balcony"].Value; string toilet = houseRegex.Groups["toilet"].Value; string kitchen = houseRegex.Groups["kitchen"].Value; string hall = houseRegex.Groups["hall"].Value; string room = houseRegex.Groups["room"].Value; house.Balcony = byteParse(balcony); house.Toilet = byteParse(toilet); house.Kitchen = byteParse(kitchen); house.Room = byteParse(room); house.Hall = byteParse(hall); house.houseInfo = new HouseInfo { AdvEquip = advEquip, BasicEquip = basicEquip, FiveYears = (fiveYears == "1"), OnlyHouse = (onlyHouse == "1"), LandYear = landYear, HouseSubType = houseSubType, HouseProperty = houseProperty, HouseType = houseType, HouseStructure = houseStructure }; return(house); }
public static ImportedHouse GetFactoryInfo(string html, ImportedHouse house) { //function setFactory(factoryType, basicEquip, priceType) Match houseRegex = new Regex( "setFactory\\('(?<factoryType>.*?)','(?<basicEquip>.*?)','(?<priceType>.*?)'").Match( html.Trim().Replace("\r", "").Replace("\n", "").Replace("\t", "")); string factoryType = houseRegex.Groups["factoryType"].Value; string basicEquip = houseRegex.Groups["basicEquip"].Value; house.factoryInfo = new FactoryInfo { FactoryType = factoryType, BasicEquip = basicEquip, }; return(house); }
/// <summary> /// 获取单个房源详情 /// </summary> /// <param name="tradeType">id</param> /// <param name="buildingType">1 住宅 2 别墅 3 商铺 4 写字楼 5 厂房</param> /// <param name="id">id</param> /// <param name="cookie">Cookie</param> /// <returns></returns> private static ImportedHouse GetHouseDetail(byte tradeType, int buildingType, string id, string cookie, DateTime date, Dictionary <int, string> communityList) { const int siteId = 1008; string html = string.Empty; try { WebProxy proxy = KuaiDaili.GetProxy(); html = HttpUtility.GetString(string.Format(detailApi, buildingType, id), GetHeaders(cookie), false, proxy); } catch (WebException ex) { return(null); } var doc = new HtmlDocument(); doc.LoadHtml(html); HtmlNode node = doc.DocumentNode; HtmlNode title_Node = node.SelectSingleNode("//input[@id='saleHouse-title']"); HtmlNode xiaoquId_Node = node.SelectSingleNode("//input[@id='cellCode']"); HtmlNode xiaoqu_Node = node.SelectSingleNode("//input[@id='cell']"); HtmlNode address_Node = node.SelectSingleNode("//input[@id='addr']"); HtmlNode area_Node = node.SelectSingleNode("//input[@id='houseArea']"); HtmlNode areaUsed_Node = node.SelectSingleNode("//input[@id='areaUsed']"); HtmlNode price_Node = node.SelectSingleNode("//input[@id='price']"); HtmlNode floor_Node = node.SelectSingleNode("//input[@id='saleHouse-basic-flooron']"); HtmlNode florrAll_Node = node.SelectSingleNode("//input[@id='saleHouse-basic-floorall']"); HtmlNode note_Node = node.SelectSingleNode("//textarea[@id='houseDescribe']"); HtmlNode yijuhua_Node = node.SelectSingleNode("//input[@id='saleHouse-tongcheng-tip']"); HtmlNode tags_Node = node.SelectSingleNode("//input[@id='saleHouse-house-tip']"); HtmlNode tese_Node = node.SelectSingleNode("//input[@id='saleHouse-eare-tip']"); //HtmlNode createTime_Node = node.SelectSingleNode("//input[@id='releaseTime']"); MatchCollection roomimageMatches = new Regex("createImgDiv\\('(.*?IMG_I.*?)'").Matches(html); MatchCollection outdoorimageMatches = new Regex("createImgDiv\\('(.*?IMG_O.*?)'").Matches(html); MatchCollection fangxingimageMatches = new Regex("createImgDiv\\('(.*?IMG_M.*?)'").Matches(html); string payType = new Regex("\\$\\(\"#payType\"\\)\\.val\\(\"(.*?)\"").Match(html).Groups[1].Value; string year = new Regex("\\$\\(\"#saleHouse-basic-year\"\\)\\.val\\('(.*?)'").Match(html).Groups[1].Value; string pointTo = new Regex("name=pointTo\\]\\[value='(.*?)'").Match(html).Groups[1].Value; string lookTime = new Regex("name=lookTime\\]\\[value='(.*?)'").Match(html).Groups[1].Value; string fitmentStatus = new Regex("name=fitmentStatus\\]\\[value='(.*?)'").Match(html).Groups[1].Value; string district = new Regex("\\$\\(\"#distrctSelect\"\\)\\.val\\('(\\d+)'").Match(html).Groups[1].Value; string area = new Regex("\\$\\(\"#areaSelect\"\\)\\.val\\('(\\d+)'").Match(html).Groups[1].Value; int districtId = PostDataHelper.RMappingAreaID(district, siteId, 592); string communityName = xiaoqu_Node.GetAttributeValue("value", ""); var community = PostDataHelper.RMappingCommunityModel(xiaoquId_Node.GetAttributeValue("value", ""), siteId); if (community == null) { return(null); } int communityId = community.CommunityID; int areaId = community.RegionID > 0?(int)community.RegionID:PostDataHelper.RMappingAreaID(area, siteId, districtId); var house = new ImportedHouse { HouseID = id, CommunityID = communityId, CommunityName = communityList != null && communityList.ContainsKey(communityId)?communityList[communityId]:communityName, CurFloor = Helper_Xms.shortParse(Helper_Xms.GetAttributeValue(floor_Node)), MaxFloor = Helper_Xms.shortParse(Helper_Xms.GetAttributeValue(florrAll_Node)), BuildArea = Helper_Xms.shortParse(Helper_Xms.GetAttributeValue(area_Node)), UsedArea = Helper_Xms.shortParse(Helper_Xms.GetAttributeValue(areaUsed_Node)), UsedYear = Helper_Xms.shortParse(year), Price = Helper_Xms.shortParse(Helper_Xms.GetAttributeValue(price_Node)), PriceUnit = tradeType == 1 ? "万" : "元/月", Address = Helper_Xms.GetAttributeValue(address_Node), Title = title_Node.GetAttributeValue("value", ""), Note = note_Node == null ? "" : note_Node.InnerHtml, YiJuHua = Helper_Xms.GetAttributeValue(yijuhua_Node), HouseLabel = Helper_Xms.GetAttributeValue(tags_Node), CellLabel = Helper_Xms.GetAttributeValue(tese_Node), Distrctid = districtId, CityID = community.CityID ?? 0, RegionID = areaId, BuildType = (byte)buildingType, FitmentStatus = fitmentStatus, PointTo = pointTo, PayType = payType, Status = 1, LookHouseTime = lookTime, TradeType = tradeType, roomImages = (from Match imageMatch in roomimageMatches select imageMatch.Groups[1].Value).ToArray(), outdoorImages = (from Match imageMatch in outdoorimageMatches select imageMatch.Groups[1].Value).ToArray(), fangxingImages = (from Match imageMatch in fangxingimageMatches select imageMatch.Groups[1].Value).ToArray(), PostTime = date }; switch (buildingType) { case 1: house = Helper_Xms.GetHouseInfo(html, house); break; case 2: house = Helper_Xms.GetVillaInfo(html, house); break; case 3: house = Helper_Xms.GetShopInfo(html, house); break; case 4: house = Helper_Xms.GetOfficeInfo(html, house); break; case 5: house = Helper_Xms.GetFactoryInfo(html, house); break; } return(house); }
/// <summary> /// /// </summary> /// <param name="houseType">租售</param> /// <param name="purpose">建筑类型</param> /// <param name="cookie"></param> /// <param name="size"></param> /// <returns></returns> public static IEnumerable <ImportedHouse> GetHouseDetails(int houseType, int purpose, string cookie, int size) { const int siteId = 2; string type = houseType == 1 ? "cs" : "cz"; int soufun_userId = int.Parse(GetMatch(cookie, "<userid>(\\d+)</userid>")); int agentId = int.Parse(GetMatch(cookie, "<agentid>(\\d+)</agentid>")); string verifyCode = GetMatch(cookie, "<verifyCode>(\\w+)</verifyCode>"); string city = GetMatch(cookie, "<city>(\\w+)</city>"); string param = string.Format(paramApi, Uri.EscapeDataString(city), agentId, type, verifyCode); if (purpose != 0) { param += "&purpose=" + GetPrupose(purpose); } string url = baseApi + param + "&wirelesscode=" + Helper_Soufun.GetWireless(param).ToLower(); string ret = HttpUtility.GetString(url, Helper_Soufun.GetUserHeaders(soufun_userId)); var houseList = Helper_Soufun.GetObjectFromSFUrl <HouseListRoot>(ret); List <ImportedHouse> houses = new List <ImportedHouse>(); foreach (var list in houseList.houselist) { //flag=1&houseid={0}&messagename=gethouseinfo&verifycode={1}&htype={2}&purpose=0&agentid={3}&city={4} string detailparam = string.Format(detailParamApi, list.houseid, verifyCode, type, agentId, Uri.EscapeDataString(city)); string detailUrl = baseApi + detailparam + "&wirelesscode=" + Helper_Soufun.GetWireless(detailparam).ToLower(); string detailRet = HttpUtility.GetString(detailUrl, Helper_Soufun.GetUserHeaders(soufun_userId)); magent_interface mi = Helper_Soufun.GetObjectFromSFUrl <magent_interface>(detailRet); if (mi != null) { magent_interfaceHouse houseDetail = mi.house; var community = PostDataHelper.RMappingCommunityModel( houseDetail.projcode.ToString(), siteId); if (community.IsNoNull()) { //var roomArr = houseDetail.roomphotourls.Split(','); //HashSet<string> rooms = new HashSet<string>(); //foreach (var room in roomArr) { // rooms.Add(room.Replace("120x120", "600x600")); //} //var fangxingArr = houseDetail.roomphotourls.Split(','); //HashSet<string> fangxingArrS = new HashSet<string>(); //foreach (var room in fangxingArr) //{ // fangxingArrS.Add(room.Replace("120x120", "600x600")); //} string content; try { string html = HttpUtility.GetString(mi.houseurl, Encoding.GetEncoding("gb2312"), null, true); content = Regex.Match(html, "<div.*id=\"hsPro-pos\".*\n([\\w\\W]*?)<div.*id=\"hsPic-pos\">").Groups[1].Value; if (string.IsNullOrEmpty(content)) { content = houseDetail.boardcontent; } } catch (Exception) { content = houseDetail.boardcontent; } ImportedHouse house = new ImportedHouse { Hall = houseDetail.hall, Room = houseDetail.room, BuildArea = houseDetail.buildingarea, UsedArea = houseDetail.livearea, PointTo = houseDetail.forward, Title = houseDetail.boardtitle, Note = content, Price = houseDetail.price, PayType = houseDetail.payinfo, PriceUnit = houseDetail.pricetype, CommunityName = houseDetail.projname, Address = houseDetail.address, Balcony = houseDetail.balcony, MaxFloor = houseDetail.totalfloor, CurFloor = houseDetail.floor, Toilet = houseDetail.toilet, UsedYear = houseDetail.createtime, HouseID = list.houseid, BuildType = BitConverter.GetBytes(houseType)[0], TradeType = BitConverter.GetBytes(purpose)[0], PicNum = houseDetail.imagecount, Kitchen = houseDetail.kitchen, CityID = community.CityID ?? 0, Distrctid = community.Distrctid ?? 0, RegionID = community.RegionID, CommunityID = community.CommunityID, roomImages = (from room in houseDetail.roomphotourls.Split(',') where !String.IsNullOrEmpty(room) select room.Replace("120x120", "600x600")).ToArray(), fangxingImages = (from room in houseDetail.housephotourls.Split(',') where !String.IsNullOrEmpty(room) select room.Replace("120x120", "600x600")).ToArray(), outdoorImages = new string[0], FitmentStatus = houseDetail.fitment }; string buildType = houseDetail.purpose; switch (buildType) { case "别墅": { house.villaInfo = new VillaInfo { BasicEquip = houseDetail.baseservice, AdvEquip = houseDetail.baseservice, }; } break; case "写字楼": { house.officeInfo = new OfficeInfo { BasicEquip = houseDetail.baseservice, Fee = houseDetail.propertyfee }; } break; case "商铺": { house.shopInfo = new ShopInfo { BasicEquip = houseDetail.baseservice }; } break; default: house.houseInfo = new HouseInfo { BasicEquip = houseDetail.baseservice, AdvEquip = houseDetail.baseservice, }; break; } houses.Add(house); } } } return(houses); }
/// <summary> /// 获取单个房源详情 /// </summary> /// <param name="tradeType">id</param> /// <param name="id">id</param> /// <param name="cookie">Cookie</param> /// <returns></returns> private static ImportedHouse GetHouseDetail(byte tradeType, string id, string cookie) { const int siteId = 1; string html = HttpUtility.GetString(string.Format(detailApi, id, tradeType), Helper_ZJB.GetHeaders(cookie)); var doc = new HtmlDocument(); doc.LoadHtml(html); HtmlNode node = doc.DocumentNode; HtmlNode title_Node = node.SelectSingleNode("//input[@id='ContentRight_txtT_HouseInfos_Address']"); HtmlNode xiaoqu_Node = node.SelectSingleNode("//input[@id='ContentRight_txtZoneName_1']"); HtmlNode address_Node = node.SelectSingleNode("//input[@id='ContentRight_Txt_AderssDesc']"); HtmlNode area_Node = node.SelectSingleNode("//input[@id='ContentRight_txtT_HouseInfos_BuildArea']"); HtmlNode areaUsed_Node = node.SelectSingleNode("//input[@id='ContentRight_txtT_HouseInfos_UsedArea']"); HtmlNode price_Node = node.SelectSingleNode("//input[@id='ContentRight_txtT_HouseInfos_Price']"); HtmlNode floor_Node = node.SelectSingleNode("//input[@id='ContentRight_txtT_HouseInfos_CurFloor']"); HtmlNode florrAll_Node = node.SelectSingleNode("//input[@id='ContentRight_txtT_HouseInfos_MaxFloor']"); HtmlNode note_Node = node.SelectSingleNode("//textarea[@id='ContentRight_txtT_HouseInfos_Note']"); HtmlNode year_Node = node.SelectSingleNode("//input[@id='ContentRight_txtUsedYear']"); HtmlNode pointTo_Node = node.SelectSingleNode( "//select[@id='ContentRight_ddlT_HouseInfos_PointTo']/option[@selected='selected']"); HtmlNode room_Node = node.SelectSingleNode("//select[@id='ContentRight_ddl_Room']/option[@selected='selected']"); HtmlNode hall_Node = node.SelectSingleNode("//select[@id='ContentRight_ddl_Hall']/option[@selected='selected']"); HtmlNode toilet_Node = node.SelectSingleNode("//select[@id='ContentRight_ddl_Toilet']/option[@selected='selected']"); HtmlNode balcony_Node = node.SelectSingleNode("//select[@id='ContentRight_ddl_Balcony']/option[@selected='selected']"); HtmlNode fitment_Node = node.SelectSingleNode("//input[@name='ctl00$ContentRight$rblT_HouseInfos_FitmentStauts' and checked='checked']"); HtmlNode buildType_Node = node.SelectSingleNode("//select[@id='ContentRight_ddlT_HouseInfos_BuildType']/option[@selected='selected']"); // HtmlNode pointTo_Node = node.SelectSingleNode("//select[@id='']/option[@selected='selected']"); // HtmlNode pointTo_Node = node.SelectSingleNode("//select[@id='']/option[@selected='selected']"); // HtmlNode note_Node = node.SelectSingleNode("//textarea[@id='"); // HtmlNode note_Node = node.SelectSingleNode("//textarea[@id='"); // HtmlNode note_Node = node.SelectSingleNode("//textarea[@id='"); // MatchCollection imageMatches = new Regex("createImgDiv\\('(.*?)'").Matches(html); // string payType = new Regex("\\$\\(\"#payType\"\\)\\.val\\(\"(.*?)\"").Match(html).Groups[1].Value; // string year = new Regex("\\$\\(\"#saleHouse-basic-year\"\\)\\.val\\('(.*?)'").Match(html).Groups[1].Value; // string pointTo = new Regex("name=pointTo\\]\\[value='(.*?)'").Match(html).Groups[1].Value; // string lookTime = new Regex("name=lookTime\\]\\[value='(.*?)'").Match(html).Groups[1].Value; // string fitmentStatus = new Regex("name=fitmentStatus\\]\\[value='(.*?)'").Match(html).Groups[1].Value; var basicEquip = node.SelectNodes("//span[@id='ContentRight_chklT_HouseInfos_BasicEquip']/input[@checked = 'checked']"); var equip_Nodes = node.SelectNodes("//span[@id='ContentRight_chklT_HouseInfos_AdvEquip']/input[@checked = 'checked']"); var otherEquip_Nodes = node.SelectNodes("//span[@id='ContentRight_chklT_HouseInfos_OverEquip']/input[@checked = 'checked']"); string equip = ""; if (basicEquip != null) { equip = basicEquip.Aggregate(equip, (current, equip_Node) => current + (equip_Node.NextSibling.InnerText + ",")); } if (equip_Nodes != null) { equip = equip_Nodes.Aggregate(equip, (current, equip_Node) => current + (equip_Node.NextSibling.InnerText + ",")); } if (otherEquip_Nodes != null) { equip = otherEquip_Nodes.Aggregate(equip, (current, equip_Node) => current + (equip_Node.NextSibling.InnerText + ",")); } string district = new Regex("change\\(\"(\\d+)\"").Match(html).Groups[1].Value; string area = new Regex("change\\(\"\\d+\", \"(\\d+)\"").Match(html).Groups[1].Value; int districtId = PostDataHelper.RMappingAreaID(district, siteId, 592); // int areaId = PostDataHelper.RMappingAreaID(area, siteId, districtId); var picMatches = Regex.Matches(html, "delpic.*?pos=(.*?)&.*?spath=(.*?)'"); string[] pics = (from Match picMatch in picMatches select picMatch.Groups[1].Value).ToArray(); // List<string> tmp = ; string communityName = xiaoqu_Node.GetAttributeValue("value", ""); var community = PostDataHelper.RMappingCommunityModel(communityName, siteId); int communityId = 0; if (community == null) { return(null); } communityId = community.CommunityID; if (communityId == 0) { return(null); } List <string> tmp1 = new List <string>(); List <string> tmp2 = new List <string>(); List <string> tmp3 = new List <string>(); int sum = 0; foreach (Match picMatch in picMatches) { sum++; string pos = Uri.UnescapeDataString(picMatch.Groups[1].Value); string pic = "http://img.ZJB.com/Upload/InfoImage" + Uri.UnescapeDataString(picMatch.Groups[2].Value); if (pos.Contains("型")) { tmp3.Add(pic); } else if (pos.Contains("外") || pos.Contains("区")) { tmp2.Add(pic); } else { tmp1.Add(pic); } } decimal con = 1; decimal buildAreaValue = shortParse(GetAttributeValue(area_Node)); decimal usedAreaValue = shortParse(GetAttributeValue(areaUsed_Node)); usedAreaValue = usedAreaValue == 0 ? (decimal)(buildAreaValue - con) : usedAreaValue; var house = new ImportedHouse { HouseID = id, CommunityID = communityId, CommunityName = communityName, CurFloor = intParse(GetAttributeValue(floor_Node)), MaxFloor = intParse(GetAttributeValue(florrAll_Node)), BuildArea = buildAreaValue, UsedArea = usedAreaValue, UsedYear = intParse(GetAttributeValue(year_Node)), Price = shortParse(GetAttributeValue(price_Node)), PriceUnit = tradeType == 1 ? "万" : "元/月", Address = GetAttributeValue(address_Node), Title = title_Node.GetAttributeValue("value", ""), Note = note_Node == null ? "" : System.Web.HttpUtility.HtmlDecode(note_Node.InnerHtml), // YiJuHua = GetAttributeValue(yijuhua_Node), // HouseLabel = GetAttributeValue(tags_Node), // CellLabel = GetAttributeValue(tese_Node), Distrctid = districtId, CityID = community.CityID ?? 0, RegionID = community.RegionID, BuildType = 1, // FitmentStatus = fitmentStatus, PointTo = GetFocus(GetAttributeValue(pointTo_Node)), // PayType = payType, Status = 1, // LookHouseTime = lookTime, TradeType = tradeType, // imageUrls = (from Match imageMatch in imageMatches select imageMatch.Groups[1].Value).ToArray(), Balcony = byteParse(GetAttributeValue(balcony_Node)), Toilet = byteParse(GetAttributeValue(toilet_Node)), // Kitchen = byteParse(GetAttributeValue)), Room = byteParse(GetAttributeValue(room_Node)), Hall = byteParse(GetAttributeValue(hall_Node)), FitmentStatus = GetAttributeValue(fitment_Node), roomImages = tmp1.ToArray(), outdoorImages = tmp2.ToArray(), fangxingImages = tmp3.ToArray(), PicNum = (byte)sum }; string buildType = buildType_Node.GetAttributeValue("value", ""); switch (buildType) { case "9": { house.villaInfo = new VillaInfo { BasicEquip = equip, AdvEquip = equip }; house.BuildType = 2; } break; case "3": { house.factoryInfo = new FactoryInfo { BasicEquip = equip }; house.BuildType = 5; } break; case "2": { house.officeInfo = new OfficeInfo { BasicEquip = equip }; house.BuildType = 4; } break; case "4": case "5": { house.shopInfo = new ShopInfo { BasicEquip = equip }; house.BuildType = 3; } break; default: house.houseInfo = new HouseInfo { BasicEquip = equip, AdvEquip = equip }; house.BuildType = 1; break; } return(house); }