On Thu, Jun 18, 2009 at 6:58 AM, Juo Hundred<juo100 / mac.com> wrote:
> Hey, I tried that
>
> [code]
> rapidshare = data.to_xml.write($stdout, 1)

This is setting rapidshare to whatever the String#write method which
is an extension to the String class provided by scrubyt.

It looks like it actually returns the number of characters written,
let's say for arguments sake that you write 42 characters, the
actually value doesn't matter since:
> rapidshare.to_s
This evaluates to "42" or whatever the string representation of the
return value from String#write was, and then does noting with the
result.

Maybe something like:

  rapidshare = data.to_xml
  rapidshare.write($stdout, 1)

which would make rapidshare reference the result of data.to_xml (which
I'm assuming here is a string.

Now to the real meat,
> rapidshare = rapidshare.delete(<"link">)

As Inigo Montoya would say, "I don't think that method means what you
think it means."

irb(main):001:0> "if l < k and k <  j then j > l".delete("<link>")
=> "f    ad    j the j  "

String#delete removes ANY characters which are in the argument from
the receiver.

If you are sure that the string in rapidshare is well formed then you
could use something like

   print rapidshare.gsub(%r{</?link>}, "")
or
   rapidshare = rapidshare.gsub(%r{</?link>}, "")
   print rapidshare

Putting it all together

require 'rubygems'
require 'scrubyt'

data = Scrubyt::Extractor.define do
  fetch 'http://www.mywebsite.com/index.php?action=login'
  fill_textfield 'user', 'myusername'
  fill_textfield 'passwrd', 'mypassword'
  submit
  fetch 'http://mywebsite/index.php?topic=672'
  link '//div/code'
end

rapidshare = data.to_xml
rapidshare.write($stdout, 1)
print rapidshare.gsub(%r{</?link>}, "")


-- 
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale