我有这个页面:www.unnu.com/music-artists
需要检索所有艺术家及其链接的完整列表。
HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();
// There are various options, set as needed
htmlDoc.OptionFixNestedTags = true;
// filePath is a path to a file containing the html
htmlDoc.Load("http://www.unnu.com/music-artists");
// Use: htmlDoc.LoadHtml(xmlString); to load from a string (was htmlDoc.LoadXML(xmlString)
// ParseErrors is an ArrayList containing any errors from the Load statement
if (htmlDoc.ParseErrors != null && htmlDoc.ParseErrors.Count() > 0)
{
// Handle any parse errors as required
}
else
{
if (htmlDoc.DocumentNode != null)
{
HtmlAgilityPack.HtmlNode bodyNode = htmlDoc.DocumentNode.SelectSingleNode("//a");
if (bodyNode != null)
{
listBox1 = ????//this is not working, do not know if the code is correct and just missing here or is this all wrong.
}
}
}
拜托,我急需这个,因为这是一份工作。如果你需要我的 Skype 是 grnmalazagnr 可以添加。