我试图在div中删除内容:
<div itemprop="articleBody">random, unique content in this div, different each time</div>
我的代码尝试获取上面的div之间的内容
var html = "random url eachtime.com";
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(html);
var nodes = doc.DocumentNode.SelectNodes("div[@itemprop=\"articleBody\"]");
var inntertexts = nodes.Select(node => node.InnerText);
articletext.Text = inntertexts.ToString();
当我访问网页以获取div之间的内容时,我得到以下内容
exception ...值不能为null。 参数名称:source
我也尝试了xpath路径:
/html[1]/body[1]/div[3]/div[2]/div[3]/div[3]/div[5]/div[1]/div[1]/div[1]
我想通过以下链接获取articleBody:view-source:http://www.dailymail.co.uk/sciencetech/article-4408856/Samsung-building-flip-phone-TWO-screens.html?ITO=1490&ns_mchannel=rss&ns_campaign=1490
我如何解决这个问题,以便获得div的内容?