yahooのスナペット(要約文)を取得するスクリプト

yahooのスナペット(要約文)を取得するスクリプト

require 'rubygems'
require 'kconv'
require 'mechanize'
require 'hpricot'
KCODE='u'


agent=Mechanize.new();
agent.user_agent_alias="Windows IE 7"
search_word="\"*とはNTTのこと\""
page=agent.get("http://search.yahoo.co.jp/search?p="+search_word+"&n=100")
text= Hpricot(page.body)

puts ((text/"div.bd")/"p").inner_html