Archive for October, 2007

Using Hpricot to fetch the title of the url passed

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.

Advertisements

October 18, 2007 at 9:47 am Leave a comment

BumpedINTO.com

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

October 8, 2007 at 7:46 am Leave a comment


Pages

Blog Stats

  • 33,758 hits
October 2007
M T W T F S S
« Sep   Dec »
1234567
891011121314
15161718192021
22232425262728
293031  

Twitter Updates

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

religion and spirituality