static void Main(string[] args) { Turtle.Move(100); }
private static void GetProductData() { try { var data = ReplaceString.PutString(""); Turtle = new Turtle(); h1 = null; h1 = new HtmlDocument(); h1.LoadHtml(DownloadedString); try { var category = h1.DocumentNode.SelectSingleNode("//ul[@class='breadcrumb']").InnerHtml.ToString(); h2 = null; h2 = new HtmlDocument(); h2.LoadHtml(category); Turtle.Category = h2.DocumentNode.SelectNodes("//li").Select(s => s.InnerText.ToString().Replace("/n", "").Trim()).Aggregate((a, b) => a + "> " + b).ToString(); } catch { Turtle.Category = string.Empty; } try { Turtle.ProductTitle = h1.DocumentNode.SelectSingleNode("//h2[@class='cimm_prodDetailTitle']").InnerText.ToString().Trim(); } catch { Turtle.ProductTitle = string.Empty; } try { Turtle.ProductDescription = h1.DocumentNode.SelectSingleNode("//p[@class='cimm_itemShortDesc']").InnerText.ToString().Trim(); } catch { Turtle.ProductDescription = string.Empty; } try { //productDetailList var tabledata = h1.DocumentNode.SelectSingleNode("//table[@id='productDetailList']").InnerHtml.ToString(); h2 = null; h2 = new HtmlDocument(); h2.LoadHtml(tabledata); try { Turtle.Manufacturers = h2.DocumentNode.SelectNodes("//tr").Where(w => w.InnerText.Contains("Manufacturers")).Select(s => s.InnerText.ToString().Replace("Manufacturers", "").Replace("/n", "").Trim()).FirstOrDefault(); } catch { Turtle.Manufacturers = string.Empty; } try { Turtle.BrandName = h2.DocumentNode.SelectNodes("//tr").Where(w => w.InnerText.Contains("Brand Name")).Select(s => s.InnerText.ToString().Replace("Brand Name", "").Replace("\n", "").Trim()).FirstOrDefault(); } catch { Turtle.BrandName = string.Empty; } try { Turtle.UPC = h2.DocumentNode.SelectNodes("//tr").Where(w => w.InnerText.Contains("UPC")).Select(s => s.InnerText.ToString().Replace("UPC", "").Replace("/n", "").Trim()).FirstOrDefault(); } catch { Turtle.UPC = string.Empty; } try { Turtle.MNP = h2.DocumentNode.SelectNodes("//tr").Where(w => w.InnerText.Contains("MPN")).Select(s => s.InnerText.ToString().Replace("MPN", "").Replace("/n", "").Trim()).FirstOrDefault(); } catch { Turtle.MNP = string.Empty; } try { Turtle.Part = h2.DocumentNode.SelectNodes("//tr").Where(w => w.InnerText.Contains("Part #")).Select(s => s.InnerText.ToString().Replace("Part #:", "").Replace("/n", "").Trim()).FirstOrDefault(); } catch { Turtle.Part = string.Empty; } } catch { } try { var specdata = h1.DocumentNode.SelectSingleNode("//div[@id='specificationSection']").InnerHtml.ToString(); h2 = null; h2 = new HtmlDocument(); h2.LoadHtml(specdata); Turtle.Specification = Stringreplace(h2.DocumentNode.SelectNodes("//tr").Select(s => s.InnerText.ToString().Replace(" ", "").Replace("\n", "").Trim()).Aggregate((a, b) => a + " | " + b).ToString()); } catch { Turtle.Specification = string.Empty; } try { Turtle.Description = h1.DocumentNode.SelectSingleNode("//div[@id='descriptionSection']").InnerText.ToString().Trim(); } catch { Turtle.Description = ""; } try { Turtle.Document = h1.DocumentNode.SelectNodes("//span[@class='cimm_pdfLink hideMe']").Select(s => s.InnerText.ToString().Trim()).Aggregate((a, b) => a + " | " + b).ToString(); } catch { Turtle.Document = ""; } try { Turtle.Features = h1.DocumentNode.SelectSingleNode("//div[@id='featureSection']").InnerText.ToString().Trim(); } catch { Turtle.Features = ""; } GetPriceString(); } catch { } finally { UpdateProductData(); Turtle = null; h1 = null; h2 = null; } }