更新时间:2023-01-17 18:37:12
The code doc.LoadHtml("http://theurl.com");
will not work. The parameter to LoadHtml should be a string containing HTML, not a URL. You must first fetch the HTML document before trying to parse it.
Once you have the document loaded, for this specific example you can use this:
IEnumerable<string> links = doc.DocumentNode
.SelectNodes("//a[@class='tim_new']")
.Select(n => n.Attributes["href"].Value);