From: Han Holl Date: 2008-10-22T18:31:29+09:00 Subject: Re: [ANN] mechanize 0.8.4 Released ------=_Part_22965_7947286.1224667885397 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Wed, Oct 22, 2008 at 8:18 AM, Aaron Patterson wrote: > > > You can submit it via the mechanize rubyforge tracker here: > > http://rubyforge.org/tracker/?group_id=1453 Ok. Did that. > > > Yes. Unfortunately you have to install a couple dependencies. First > install racc which is available here: > > http://i.loveruby.net/en/projects/racc/ > > And install frex > > % sudo gem install aaronp-frex -s http://gems.github.com > -s no longer works with gem. Sould be --source > > I realize that is kind of a pain in the butt, so I've posted a > development version of the gem on my internet homesite. Just download > the gem from here: > > http://tenderlovemaking.com/nokogiri-0.0.0.20081021110113.gem > > gem install nokogiri-0.0.0.20081021110113.gem produced: No definition for owned_eh (twice) Unfortunately, it doesn't work at all. And even more unfortunately, it's not easy for me to debug, because while 'pp page.parser' in the Hpricot case gives a detailed result from the parsing process, it just gives: #[], "nodeset"=>[]}> in the nokogiri version. I have distilled a small example, without too many dependencies: #!/usr/bin/ruby -w require 'rubygems' if ENV['NOKOGIRI'] require 'nokogiri' end require 'mechanize' if ENV['NOKOGIRI'] WWW::Mechanize.html_parser = Nokogiri::HTML end class ImdbScraper def initialize @agent = WWW::Mechanize.new { |agent| agent.user_agent_alias = 'Linux Mozilla' } @baseurl = 'http://www.imdb.com' page = @agent.get(@baseurl) @search = page.form('find') end def search(lookfor, year = nil) @search.q = lookfor page = @agent.submit(@search) end end s = ImdbScraper.new page = s.search('The Catered Affair', '1956') puts page.at('//div.info') # end-of-program Run with and without the NOKOGIRI environment variable set, and see the difference. Maybe I'm missing something else that is silently ignored ? Cheers, Han Holl ------=_Part_22965_7947286.1224667885397--