Ehud Rosenberg
2007-Nov-14 19:40 UTC
[Mechanize-users] Hpricot & mechanize fail to parse page after redirect1q
Hi everyone, My quest with mechanize/Hpricot continues :) Something extremely strange happened today - some simple working code broke down, and i can''t figure out why. I am trying to access a piratebay.org search page, which does a redirect to a relative url like this: original link: http://thepiratebay.org/s/?page=0&orderby=3&q=football+manager+2008&searchTitle=on redirects to: /search/football manager 2008/0/3/0 Now, this all worked dandily up till yesterday. The page was redirected fine, and mechanize even handled the cookie that was sent back from the site. But today, i am getting this strange error: "URI::InvalidURIError: bad URI(is not URI?): /search/football manager/2008/0/3/0" Mechanize gives the following message: "NoMethodError: You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occurred while evaluating nil.last" from C:/Web/ruby/lib/ruby/gems/1.8/gems/mechanize-0.6.10/lib/mechanize.rb:402:in `to_absolute_uri'' I have tested this on 2 different machines, and they both break down. Can someone please give it a go and see if they can figure it out? I would be very very thankful :) Thanks, Ehud PS - I am using hpricot 0.6, and the redirected page is parsed correctly when accessed directly. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mechanize-users/attachments/20071114/5b9cf69f/attachment.html