C
Cisco Ri
Anybody have a code snippet that extracts the title from the <title> tag
from a given URL?
from a given URL?
2009/4/24 Cisco Ri said:Anybody have a code snippet that extracts the title from the <title> tag
from a given URL?
Cisco said:Anybody have a code snippet that extracts the title from the <title> tag
from a given URL?
Heesob said:require 'rubygems'
require 'mechanize'
title = WWW::Mechanize.new.get('http://google.com').title
=> "Google"
Regards,
Park Heesob
You can work around like this:2009/4/28 Cisco Ri said: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.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.