Watson1978
2/13/2011 - 1:10 PM

MacRuby : Mechanize

MacRuby : Mechanize

/Library/Frameworks/MacRuby.framework/Versions/0.9/usr/lib/ruby/1.9.2/forwardable.rb:185:in `search:': undefined method `html_parser' for nil:NilClass (NoMethodError)
	from /Library/Frameworks/MacRuby.framework/Versions/0.9/usr/lib/ruby/Gems/1.9.2/gems/mechanize-1.0.0/lib/mechanize/page.rb:208:in `block'
	from /Library/Frameworks/MacRuby.framework/Versions/0.9/usr/lib/ruby/Gems/1.9.2/gems/mechanize-1.0.0/lib/mechanize/page.rb:207:in `links'
	from /Users/watson/tmp/test_mechanize.rb:12:in `block'
	from /Library/Frameworks/MacRuby.framework/Versions/0.9/usr/lib/ruby/Gems/1.9.2/gems/mechanize-1.0.0/lib/mechanize.rb:262:in `get:'
	from /Users/watson/tmp/test_mechanize.rb:11:in `<main>'
# -*- coding: utf-8 -*-
require "rubygems"
require "mechanize"

URI_QUERY = "http://www.google.co.jp/search?hl=ja&q=site:www.amazon.co.jp Beatles"

agent = Mechanize.new{|a|
  a.user_agent_alias = "Mac Safari"
}

agent.get(URI_QUERY) do |page|
  p page.links
end