Skip to content

Instantly share code, notes, and snippets.

@naoranger
Created August 18, 2012 03:18
Show Gist options
  • Select an option

  • Save naoranger/3384123 to your computer and use it in GitHub Desktop.

Select an option

Save naoranger/3384123 to your computer and use it in GitHub Desktop.
horikoji sample
require 'nokogiri'
require 'open-uri'
url = "https://dl.dropbox.com/u/11503045/rbsmp1.html"
doc = Nokogiri::HTML(open(url).read, nil, 'Shift_JIS')
doc.xpath('//body').children.each_with_index do |item, i|
p "#{i}:#{item.text}"
p item.text.scan(/\w+/)[0]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment