Skip to content

Instantly share code, notes, and snippets.

@hitode909
Created July 23, 2010 08:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hitode909/487170 to your computer and use it in GitHub Desktop.
Save hitode909/487170 to your computer and use it in GitHub Desktop.
e-WordsからIT用語リストを取ってくる
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