Hi there,
I’m trying to use Scrubyt for my project however it fails on me. I took
the source code sample from the Wiki:
require ‘rubygems’
require ‘scrubyt’
google_data = Scrubyt::Extractor.define do
#Perform the action(s)
fetch ‘Google’
fill_textfield ‘q’, ‘ruby’
submit
#Construct the wrapper
link “Ruby P.ming Language” do
url “href”, :type => :attribute
end
next_page “Next”, :limit => 2
end
puts google_data.to_xml
/Library/Ruby/Gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/core/navigation/agents/mechanize.rb:178:in
fill_textfield': undefined method
[]=’ for nil:NilClass
(NoMethodError)
from
/Library/Ruby/Gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/core/navigation/navigation_actions.rb:27:in
eval' from /Library/Ruby/Gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/core/navigation/agents/mechanize.rb:178:in
fill_textfield’
from
/Library/Ruby/Gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/core/navigation/navigation_actions.rb:27:in
fill_textfield' from x.rb:8 from /Library/Ruby/Gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/core/shared/extractor.rb:75:in
instance_eval’
from
/Library/Ruby/Gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/core/shared/extractor.rb:75:in
initialize' from /Library/Ruby/Gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/core/shared/extractor.rb:32:in
new’
from
/Library/Ruby/Gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/core/shared/extractor.rb:32:in
`define’
from x.rb:4
For some other code, I’m getting:
/Library/Ruby/Gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/core/scraping/filters/tree_filter.rb:96:in
generate_XPath_for_example': undefined method
parent’ for nil:NilClass
(NoMethodError)
from
/Library/Ruby/Gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/core/scraping/filters/tree_filter.rb:89:in
loop' from /Library/Ruby/Gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/core/scraping/filters/tree_filter.rb:89:in
generate_XPath_for_example’
from
/Library/Ruby/Gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/core/scraping/pattern.rb:113:in
initialize' from /Library/Ruby/Gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/core/scraping/pattern.rb:112:in
each’
from
/Library/Ruby/Gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/core/scraping/pattern.rb:112:in
initialize' from /Library/Ruby/Gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/core/shared/extractor.rb:69:in
new’
from
/Library/Ruby/Gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/core/shared/extractor.rb:69:in
method_missing' from z.rb:8 from /Library/Ruby/Gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/core/shared/extractor.rb:75:in
instance_eval’
from
/Library/Ruby/Gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/core/shared/extractor.rb:75:in
initialize' from /Library/Ruby/Gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/core/shared/extractor.rb:32:in
new’
from
/Library/Ruby/Gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/core/shared/extractor.rb:32:in
`define’
from z.rb:5
I found few similar error posts, but not replies. Did somebody manage
to fix that? I really like what Scrubyt can do, but it doesn’t work for
me. So could you otherwise advise me an alternative to it as well?
Thanks.