我正在使用HTML Agility Pack和Fizzler (这样我就可以使用CSS选择器)来抓取结果页面。
我首先创建html文档,然后创建一个节点列表,这样每个节点都是一个单独的结果。
IEnumerable<HtmlNode> sections = document.DocumentNode.QuerySelectorAll("selector");
我现在想深入到这些节点中的每一个,以获取我想要的特定数据,但我在这里迷路了。
我试过了:
foreach (HtmlNode n in sections)
{
var phone = n.QuerySelectorAll("selector");
string myVar = phone.InnerHtml; // this doesn't work, the innerhtml property is not there.
}
有人能告诉我怎么做吗?我所见过的所有示例都止步于创建节点列表。
发布于 2014-09-24 15:14:50
好吧,这是愚蠢的简单。我需要使用QuerySelector
而不是QuerySelectorAll
https://stackoverflow.com/questions/26020349
复制相似问题