追記:Production パーサ
上記コードの最後に
sankei.export(__FILE__)
を追加して実行し、出来たのが以下。
require 'rubygems' require 'scrubyt' sankei = Scrubyt::Extractor.define do mechanize = WWW::Mechanize.new mechanize_doc = mechanize.get(NEWSFLASH) mechanize_doc.body = NKF.nkf('--utf8', mechanize_doc.body) fetch(NEWSFLASH, mechanize_doc) record "/html/body/div/div/div" do title "/p[2]/span[1]".toutf8 time "/p[1]" (abstract "/p[2]").toutf8 end.ensure_presence_of_pattern('abstract') end sankei.to_xml.write($stdout, 1)