Knowledge Base

October 18, 2007

Using Hpricot to fetch the title of the url passed

Filed under: Technical — rkutti @ 9:47 am

When surfing the net I found Hpricot for Ruby.This helps me in parsing the HTML pages.
To install ‘hpricot’ use gem installer..
In the command prompt type this to install ‘hpricot’
gem install hpricot

Then in your code include ‘hpricot’ using

require ‘hpricot’
require ‘open-uri’

@title = (Hpricot(open(url))/:title).inner_text

This code will help in fetching the title of the html pages.

The code under my prevoius post ‘Get the title of the given url using ruby’ can be replaced with this code. This reduces the number of lines of code.

I got this code from this link
The usage of Hpricot doesn’t stop with this. It is used in many cases, i will post usages of ‘hrpicot’ in future.

October 8, 2007

BumpedINTO.com

Filed under: Technical — rkutti @ 7:46 am

BumpedInto is a Social Profile Bookmarking application which helps you in achieving your goals.

You can take a quick look of the tour to know more about this bookmarking application.

Tour

Click here to Sign-Up

Blog at WordPress.com.