Last active
October 24, 2015 04:04
-
-
Save ryoakg/aa148d8320b86978ff0d to your computer and use it in GitHub Desktop.
script, noscript を全部抜く
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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