NSoup是JSoup的Net移植版本。使用方法基本一致。
特性:
jQuery风格的CSS选择器对不信任的源的HTML进行清理操作HTML文档.示例代码:
NSoup.Nodes.Documentdoc=NSoup.NSoupClient.Parse(HtmlString);NSoup.Nodes.Documentdoc=NSoup.NSoupClient.Connect("https://www.oschina.net/").Get();ebClientwebClient=newWebClient();StringHtmlString=Encoding.GetEncoding("utf-8").GetString(webClient.DownloadData("https://www.oschina.net/"));NSoup.Nodes.Documentdoc=NSoup.NSoupClient.Parse(HtmlString);WebRequestwebRequest=WebRequest.Create("https://www.oschina.net/");NSoup.Nodes.Documentdoc=NSoup.NSoupClient.Parse(webRequest.GetResponse().GetResponseStream(),"utf-8");
评论