public static SkelbiuLtFlatAd ToFlatAd(this SkelbiuLtAd ad) { if (ad.Price == null) { } return(new SkelbiuLtFlatAd() { WebId = ad.Id, Title = ad.Title, FullLink = ad.Link, Price = decimal.Parse(ad.Price), Currency = ad.Currency, Description = ad.Description, Flat = new SkelbiuLtFlat { City = ad.City, Place = AdToFlatAdParser.GetPlace(ad.OtherInfo), Area = AdToFlatAdParser.GetArea(ad.OtherInfo), Features = ad.FeaturesDetails, Floor = AdToFlatAdParser.GetFloor(ad.OtherInfo), TotalFloors = AdToFlatAdParser.GetFloors(ad.OtherInfo), Heating = AdToFlatAdParser.GetHeating(ad.OtherInfo), HouseNumber = AdToFlatAdParser.GetHouseNum(ad.OtherInfo), Installation = AdToFlatAdParser.GetInstallation(ad.OtherInfo), Neighborhood = AdToFlatAdParser.GetNeighborhood(ad.OtherInfo), Rooms = AdToFlatAdParser.GetRooms(ad.OtherInfo), Street = AdToFlatAdParser.GetStreet(ad.OtherInfo), Year = AdToFlatAdParser.GetYear(ad.OtherInfo) }, Phone = ad.Phone }); }
internal SkelbiuLtAd LoadFullFlatAd(string url) { try { var adPage = CQ.CreateFromUrl(url); var id = adPage["#adID"].Text(); var title = adPage["#adTitle"].Text(); var description = adPage["#adDescription"].Text(); var featuresDetails = adPage["#featuresDetails"].Text(); var price = adPage["meta[itemprop='price']"].Attr("content"); var currency = adPage["meta[itemprop='priceCurrency']"].Attr("content"); var city = adPage[".seller-location > .seller-location-main"].Text(); var phone = adPage[".seller-phone"].Text(); var ad = new SkelbiuLtAd() { Link = url, Id = id, City = city, Currency = currency, Description = description, FeaturesDetails = featuresDetails, Phone = phone, Price = price, Title = title }; var groups = adPage[".fieldGroupArea"].Selection.ToList(); var values = adPage[".fieldGroupArea > .fieldValue"].Text(); for (var i = 0; i < groups.Count(); i++) { ad.OtherInfo.Add(new AdFieldGroup( groups[i].ChildNodes[0].InnerText.Replace(":", "").Trim(), groups[i].ChildNodes[1].InnerText.Trim())); } return(ad); } catch (WebException exception) { return(null); } catch (Exception ex) { return(null); } }