I am running Windows XP. I just installed the latest version of Ruby(1.9) - Hpricot, Mechanize and Scrubyt installed without any issues. I have tried to work with the simplest examples I could find to get scrubyt working. example :
require 'rubygems'
require 'scrubyt'
data = Scrubyt::Extractor.define do
fetch 'http://google.com'
title '//head/title'
end
data.to_xml.write($stdout, 1)
but, I keep getting the error :
C:/ruby/lib/ruby/gems/1.9.1/gems/scrubyt-0.4.06/lib/scrubyt.rb:1: warning: varia
ble $KCODE is no longer effective; ignored
C:/ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no
such file to load -- jcode (LoadError)
from C:/ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `
require'
from C:/ruby/lib/ruby/gems/1.9.1/gems/scrubyt-0.4.06/lib/scrubyt.rb:2:in
`<top (required)>'
from C:/ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:53:in `
require'
from C:/ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:53:in `
rescue in require'
from C:/ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `
require' from te.rb:2:in `<main>'
I have tried several starter examples, all give the same error message. I just started with ruby today, so I can't really figure out what's going on.
Thanks!
It seems
scrubyt
is not ruby 1.9-ready, asjcode
was used in 1.8 to deal with encoding issues. As of 1.9, ruby has a better encoding support (esp. utf-8) and therefore doesn’t needjcode
anymore.With 1.9.2:
With 1.8.7:
I tried to change the Scrubyt files as follows to work around that issue:
and got further problems... So more work would need to be done to get Scrubyt to run with ruby 1.9.
FWIW, your use case is more than likely more complicated, but your example can be done with Mechanize (which Scrubyt uses internally):