Skip to content

Instantly share code, notes, and snippets.

@tobynet
Forked from hitode909/ewords.rb
Created July 27, 2010 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobynet/492857 to your computer and use it in GitHub Desktop.
Save tobynet/492857 to your computer and use it in GitHub Desktop.
require 'nokogiri'
require 'open-uri'
# usage: ruby ewords.rb > keywords.txt
root_url = 'http://e-words.jp/'
indices = Nokogiri(open(root_url)).search('.index a')
result = []
indices.each_with_index { |index, i|
warn "#{i+1} / #{indices.length} #{index.text}"
result << Nokogiri(open(root_url + index['href'])).search('a[href^="../w"]').map(&:text)
}
puts result.join("\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment