- htmlweb webClient = new HtmlWeb();
- HtmlDocument doc = webClient.Load("http://xxx");
- HtmlNodeCollection hrefList = doc.DocumentNode.SelectNodes(".//a[@href]");
- if (hrefList != null)
- {
- foreach (HtmlNode href in hrefList)
- {
- HtmlAttribute att = href.Attributes["href"];
- doSomething(att.Value);
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/110720134557.html
来源: http://www.codesnippet.cn/detail/110720134557.html