public void GetCars() { var carNodes = doc.DocumentNode.SelectNodes("//tr[@class='search_vehicle_basic_row search_name_cell']"); if (carNodes != null) { foreach (var carNode in carNodes) { Dictionary<string, string> carProperties = new Dictionary<string, string>(); carProperties.Add("Lane", ""); carProperties.Add("Run", ""); carProperties.Add("Year", ScrapeYear(carNode)); carProperties.Add("MakeModel", ScrapeMakeModel(carNode)); carProperties.Add("EngineTransmission", ""); carProperties.Add("Odometer", ScrapeOdometer(carNode)); carProperties.Add("Color1", ScrapeColor1(carNode)); carProperties.Add("Color2", ""); carProperties.Add("Vin", ScrapeVin(carNode)); carProperties.Add("Bin", ""); carProperties.Add("Bid", ""); DecodeThisScraper decodeThisScraper = new DecodeThisScraper(); DecodeThisResult decodeThisResult = decodeThisScraper.GetResult(carProperties["Vin"]); carProperties.Add("DecodeThisYearMakeModel", decodeThisResult.YearMakeModel); CarInfoScraped(carProperties); } } }
public void GetCars() { var carNodes = doc.DocumentNode.SelectNodes("//tr[@class='search_vehicle_basic_row search_name_cell']"); if (carNodes != null) { foreach (var carNode in carNodes) { Dictionary <string, string> carProperties = new Dictionary <string, string>(); carProperties.Add("Lane", ""); carProperties.Add("Run", ""); carProperties.Add("Year", ScrapeYear(carNode)); carProperties.Add("MakeModel", ScrapeMakeModel(carNode)); carProperties.Add("EngineTransmission", ""); carProperties.Add("Odometer", ScrapeOdometer(carNode)); carProperties.Add("Color1", ScrapeColor1(carNode)); carProperties.Add("Color2", ""); carProperties.Add("Vin", ScrapeVin(carNode)); carProperties.Add("Bin", ""); carProperties.Add("Bid", ""); DecodeThisScraper decodeThisScraper = new DecodeThisScraper(); DecodeThisResult decodeThisResult = decodeThisScraper.GetResult(carProperties["Vin"]); carProperties.Add("DecodeThisYearMakeModel", decodeThisResult.YearMakeModel); CarInfoScraped(carProperties); } } }
public void GetCars() { using (StringReader reader = new StringReader(doc.DocumentNode.SelectSingleNode("//pre").InnerHtml)) { string line = string.Empty; do { line = reader.ReadLine(); if (line != null) { if (line.Contains("pre_inv_ps-vdp")) { Dictionary<string, string> carProperties = new Dictionary<string, string>(); Match match = Regex.Match(line, @"<a.*?>(.*?)</a>", RegexOptions.IgnoreCase); string matchValue = match.Value; string makeModel = Regex.Replace(matchValue, @"</?a.*?>", ""); line = line.Replace(matchValue, ""); string[] carPropertyArray = line.Trim().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); carProperties.Add("Lane", carPropertyArray[0]); carProperties.Add("Run", carPropertyArray[1]); carProperties.Add("Year", carPropertyArray[2]); carProperties.Add("MakeModel", makeModel); carProperties.Add("EngineTransmission", carPropertyArray[3]); carProperties.Add("Odometer", carPropertyArray[4]); carProperties.Add("Color1", carPropertyArray[5]); carProperties.Add("Color2", ""); carProperties.Add("Vin", carPropertyArray[6]); carProperties.Add("Bin", ""); carProperties.Add("Bid", ""); DecodeThisScraper decodeThisScraper = new DecodeThisScraper(); DecodeThisResult decodeThisResult = decodeThisScraper.GetResult(carProperties["Vin"]); carProperties.Add("DecodeThisYearMakeModel", decodeThisResult.YearMakeModel); CarInfoScraped(carProperties); } } } while (line != null); } }
public void GetCars() { using (StringReader reader = new StringReader(doc.DocumentNode.SelectSingleNode("//pre").InnerHtml)) { string line = string.Empty; do { line = reader.ReadLine(); if (line != null) { if (line.Contains("pre_inv_ps-vdp")) { Dictionary <string, string> carProperties = new Dictionary <string, string>(); Match match = Regex.Match(line, @"<a.*?>(.*?)</a>", RegexOptions.IgnoreCase); string matchValue = match.Value; string makeModel = Regex.Replace(matchValue, @"</?a.*?>", ""); line = line.Replace(matchValue, ""); string[] carPropertyArray = line.Trim().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); carProperties.Add("Lane", carPropertyArray[0]); carProperties.Add("Run", carPropertyArray[1]); carProperties.Add("Year", carPropertyArray[2]); carProperties.Add("MakeModel", makeModel); carProperties.Add("EngineTransmission", carPropertyArray[3]); carProperties.Add("Odometer", carPropertyArray[4]); carProperties.Add("Color1", carPropertyArray[5]); carProperties.Add("Color2", ""); carProperties.Add("Vin", carPropertyArray[6]); carProperties.Add("Bin", ""); carProperties.Add("Bid", ""); DecodeThisScraper decodeThisScraper = new DecodeThisScraper(); DecodeThisResult decodeThisResult = decodeThisScraper.GetResult(carProperties["Vin"]); carProperties.Add("DecodeThisYearMakeModel", decodeThisResult.YearMakeModel); CarInfoScraped(carProperties); } } } while (line != null); } }