I'm using Ruby, with the Nokogiri module, and i want to get the content of the body without the script elements.
Nokogiri parse uses XPATH or CSS 3.0. XPATH i really dont understand, and i can't find the 开发者_如何学PythonCSS selector to achieve my goals.
I don't think such selection is possible with XPath.
I'm not that familiar with Ruby or Nokogiri, but based on answers to a similar question, you might want to try selecting all script elements from the HTML document and removing them.
doc = Nokogiri::HTML(your_html)
doc.xpath("//script").remove
Adjust accordingly.
精彩评论