The "Data-video-ids" that you are trying to filter is not a class, but an attribute - try selecting the following expression in SelectNodes:
"//span[@data-video-ids]"
To get the attribute value, you can try this approach (since HtmlAgilityPack does not support attribute selection, you need to get the element first and then select the actual attribute):
foreach(HtmlNode node in doc.DocumentNode.
SelectNodes("//span[@data-video-ids]"))
{
var videoIds = node.Attributes["data-video-ids"];
if (videoIds == null) continue;
string text = videoIds.Value;
lblTest2.Text += text + Environment.NewLine;
}
source
share