去掉注释、样式、和js代码:
foreach(var script in doc.DocumentNode.Descendants("script").ToArray()) script.Remove();foreach(var style in doc.DocumentNode.Descendants("style").ToArray()) style.Remove(); foreach (var comment in doc.DocumentNode.SelectNodes("//comment()").ToArray()) comment.Remove();//新增的代码
时间: 2024-10-15 19:44:15