nokogiriでhtmlページをスクレイピングしていて、すべてのスタイル属性を削除したいと思います。
どうすればこれを達成できますか?(私はレールを使用していないので、サニタイズ方法を使用できません。また、サニタイズジェムを使用したくないので、ホワイトリストではなくブラックリストから削除します)
html = open(url)
doc = Nokogiri::HTML(html.read)
doc.css('.post').each do |post|
puts post.to_s
end
=> <p><span style="font-size: x-large">bla bla <a href="http://torrentfreak.com/netflix-is-killing-bittorrent-in-the-us-110427/">statistica</a> blabla</span></p>
なりたい
=> <p><span>bla bla <a href="http://torrentfreak.com/netflix-is-killing-bittorrent-in-the-us-110427/">statistica</a> blabla</span></p>