public TARIF extractTarifFromHtml(string rstring, string url) { var tarif = new TARIF();//new Tarif(); tarif.URL = url; tarif.SITE_ADI = siteAdi; htmlDoc.OptionFixNestedTags = true; try { htmlDoc.LoadHtml(rstring); //imgSource.ToList<HtmlNode>()[1].InnerHtml var currentTarif = htmlDoc.DocumentNode.Descendants("h1").ToList <HtmlNode>()[0]; tarif.YEMEK_ADI = toTurkish(currentTarif.InnerHtml); tarif.KATEGORI = toTurkish(htmlDoc.DocumentNode.Descendants().Where(x => x.HasClass("taxonomy")).ToList <HtmlNode>()[1].InnerText); tarif.RESIM = currentTarif.ParentNode.ParentNode.ParentNode.Descendants("img").ToList <HtmlNode>()[0].Attributes["src"].Value; tarif.MALZEMELER = appendString("", htmlDoc.GetElementbyId("malzemeler").ParentNode.Descendants("ul").ToList <HtmlNode>()[0].Descendants("li").ToList <HtmlNode>().Select(x => x.InnerText).ToList <String>()); tarif.HAZIRLANIS = appendString("", htmlDoc.GetElementbyId("malzemeler").ParentNode.Descendants("ol").ToList <HtmlNode>()[0].Descendants("li").ToList <HtmlNode>().Select(x => x.InnerText).ToList <String>()); //Console.WriteLine(tarif.ToString()); return(tarif); } catch (Exception ex) {; //Console.WriteLine(ex); Console.WriteLine("tarif çıkarılamadı : " + url); return(null); } }
public TARIF extractTarifFromHtml(string rstring, string url) { if (!url.Contains("/tarif/")) { return(null); } var tarif = new TARIF();//new Tarif(); tarif.URL = startUrl + url; tarif.SITE_ADI = siteAdi; htmlDoc.OptionFixNestedTags = true; try { htmlDoc.LoadHtml(rstring); //imgSource.ToList<HtmlNode>()[1].InnerHtml var currentTarif = htmlDoc.DocumentNode.Descendants("h1").ToList <HtmlNode>()[1]; tarif.YEMEK_ADI = toTurkish(currentTarif.InnerHtml); tarif.RESIM = currentTarif.ParentNode.ParentNode.ParentNode.Descendants("img").ToList <HtmlNode>()[0].Attributes["src"].Value; tarif.HAZIRLANIS = ""; tarif.MALZEMELER = ""; tarif.KATEGORI = toTurkish(htmlDoc.DocumentNode.Descendants().Where(x => x.HasClass("_4sHUQUTiHjMXXArCyqTZk")).ToList <HtmlNode>()[0].InnerText); var list = htmlDoc.DocumentNode.Descendants().Where(x => x.HasClass("_3Z2MUIzzMNhESoosDGuUqN")).ToList <HtmlNode>(); for (var i = 0; i < list.Count; i++) { if (i == list.Count - 1) { tarif.HAZIRLANIS += appendString(tarif.HAZIRLANIS, list[i].Descendants("li").ToList <HtmlNode>().Select(x => x.InnerText).ToList <String>()); } else { tarif.MALZEMELER = appendString(tarif.MALZEMELER, list[i].Descendants("li").ToList <HtmlNode>().Select(x => (x.InnerText.Substring(0, x.InnerText.Length - x.Descendants("div").ToList <HtmlNode>()[x.Descendants("div").ToList <HtmlNode>().Count - 1].InnerText.Length) + " " + x.Descendants("div").ToList <HtmlNode>()[x.Descendants("div").ToList <HtmlNode>().Count - 1].InnerText)).ToList <String>()); } } Console.WriteLine(tarif.ToString()); return(tarif); } catch (Exception ex) { //Console.WriteLine(ex); Console.WriteLine("tarif çıkarılamadı : " + url); return(null); } }
partial void DeleteTARIF(TARIF instance);
partial void UpdateTARIF(TARIF instance);
partial void InsertTARIF(TARIF instance);