i am using CsQuery library for crawling. Code is like this.
var dom = CQ.CreateDocument(htmlContent);
resultText= dom[cssSelector].Text();
I don't want script tags in resultText
for example this part <script> somethings </script>
I tried this dom[cssSelector].Not("script").Text();
. But is not working.
How can i delete all script values?
The library hasn't been updated in over three years, so it is possible that it no longer works.
Looking at the given documentation, you can try using:
CQ script = dom["script"];
script.remove();
This will remove all script tags
Solved. This code removes all scripts.
dom = dom["body script"].Remove();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.