【发布时间】:2017-03-21 11:19:55
【问题描述】:
我正在尝试从site 中提取简短的小简介(哈哈)。
下面是我要提取的 HTML。
<div class="field field-name-field-body-medium field-type-text-long field-label-hidden">
The community comics collaboration is back for another heaping helping of Academy fun!
</div>
我当前使用的代码不起作用。
var shortBio = doc.DocumentNode.Descendants("div").Where(p => p.Attributes.Contains("class") && p.Attributes["class"]
.Value.Contains("field field - name - field - body - medium field - type - text - long field - label - hidden"));
for (int i = 0; i < 5; i++)
{
blurbs[i] = shortBio.ElementAt(i).ToString();
}
显然这不起作用,我不确定如何提取文本。我一直在寻找关于拉动的信息
提前谢谢你。
【问题讨论】:
标签: c# html html-agility-pack