Skip to content

Instantly share code, notes, and snippets.

@fumokmm
Created November 15, 2009 16:32
Show Gist options
  • Save fumokmm/235319 to your computer and use it in GitHub Desktop.
Save fumokmm/235319 to your computer and use it in GitHub Desktop.
辞書サイトからランダムにキーワードを取得する(Wikipedia版)
// http://ja.wikipedia.org/wiki/特別:おまかせ表示
def url = 'http://ja.wikipedia.org/wiki/%E7%89%B9%E5%88%A5:%E3%81%8A%E3%81%BE%E3%81%8B%E3%81%9B%E8%A1%A8%E7%A4%BA'
def html = new URL(url).getText('UTF-8')
def word = html.replaceAll(/(?s)^.+<title>| - Wikipedia<\/title>.+$/, '')
println word
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment