Forum: RForum Scrubyt fails

Posted by Olexandr Prokhorenko (white)
on 2009-10-01 03:12
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 'http://www.google.com/ncr'
   fill_textfield 'q', 'ruby'
   submit

   #Construct the wrapper
   link "Ruby Programming 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.
Posted by Heinz Strunk (cojones)
on 2009-10-28 22:59
Hey,

got the same problem. Did you find a solution?
Posted by Olexandr Prokhorenko (white)
on 2009-10-28 23:01
Heinz Strunk wrote:
> Hey,
> 
> got the same problem. Did you find a solution?

Yep.  This worked for me 
http://live.prokhorenko.us/2009/10/scrubyt-in-house.html
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.