<td class="like">Some text</td>
这应该有效,但它不会:
var getLikes = doc.DocumentNode.Descendants().Where(d => d.Attributes["class"] != null && d.Attributes["class"].Value.Contains("like"));
foreach (var item in getLikes)
{
Likes.Text = item.InnerText;
}
另请注意,这个也不起作用:
var getLikes = doc.DocumentNode.Descendants("td").Where(d => d.Attributes["class"] != null && d.Attributes["class"].Value.Contains("like"));
foreach (var item in getLikes)
{
Likes.Text = item.InnerText;
}
那么,有什么想法吗?