我想从HTML源中提取文本.我正在尝试使用c#和htmlagilitypack dll.
来源是:
Here 2 | 39% | Here 1 | 263% |
如何从表中获取文本Here 1和Here 2?
HtmlDocument htmlDoc = new HtmlDocument(); htmlDoc.LoadHtml("web page string"); var xyz = from x in htmlDoc.DocumentNode.DescendantNodes() where x.Name == "td" && x.Attributes.Contains("class") where x.Attributes["class"].Value == "title" select x.InnerText;
不是很漂亮,但应该工作