HtmlAgilityPack获得H4

时间:2018-07-26 14:50:16

标签: .net asp.net-mvc

结果:所有结果都相同,我猜SelectSingleNode是问题

列表说明=新的List(); enter code here             上市日期=新的List();             HtmlAgilityPack.HtmlWeb hWeb =新的HtmlAgilityPack.HtmlWeb();             HtmlAgilityPack.HtmlDocument hDoc = hWeb.Load(“ http://kulturegitim.com.tr/Etkinliklerimiz/”);

        var text = hDoc.DocumentNode.SelectNodes("//div[@class='portfolio-item-details']");
        var imgsrc = hDoc.DocumentNode.SelectNodes("//div[@class='portfolio-item-thumbnail']");

        foreach (HtmlAgilityPack.HtmlNode item in text)
        {
            description.Add(item.SelectSingleNode("//h4").InnerHtml);
            date.Add(item.SelectSingleNode("//p").InnerHtml);
        }

0 个答案:

没有答案