Skip to content

Instantly share code, notes, and snippets.

@ryoakg
Last active October 24, 2015 04:04
Show Gist options
  • Save ryoakg/aa148d8320b86978ff0d to your computer and use it in GitHub Desktop.
Save ryoakg/aa148d8320b86978ff0d to your computer and use it in GitHub Desktop.
script, noscript を全部抜く
require 'nokogiri'
open('xxx.html') {|f|
doc = Nokogiri::HTML(f)
doc.css('script, noscript').each(&:unlink)
open(output_filename, mode='w'){|f|
html_str = doc.to_html(encoding: 'UTF-8')
f.print html_str
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment