Heesob Park wrote:
> 2009/4/24 Cisco Ri <cisco.riordan / gmail.com>:
>> Anybody have a code snippet that extracts the title from the <title> tag
>> from a given URL?
> 
> require 'rubygems'
> require 'mechanize'
> title = WWW::Mechanize.new.get('http://google.com').title
> => "Google"
> 
> 
> Regards,
> Park Heesob

I used this method for a while, and it was fine for most sites. 
However, with wikipedia.org it errored out with a 403 Forbidden error. 
The Hpricot/open-uri method works for most sites, including 
wikipedia.org, but for thesixtyone.com (Javascript intensive site) it 
errors out with a 500 Internal Server error.

I haven't tried out the open-uri only method yet.

Thanks for the help everyone.
-- 
Posted via http://www.ruby-forum.com/.