From: Logan Capaldo Date: 2006-09-05T23:16:04+09:00 Subject: Re: how do i get a url's domain On Sep 5, 2006, at 10:02 AM, Gustav - Railist wrote: > Hey! > > Can anybody tell me if there's a way to find what the domain of a > url is ? > I was thinking somehow using Net::HTTP? > > e.g. > > del.icio.us => icio.us > -or- > mrboulder.blogspot.com => blogspot.com > > Thanks! > > Gustav > require 'uri' uri = URI.parse( 'http://del.icio.us' ) puts uri.host Unfortunately you can't get more fine grained than that without asking DNS. Why? Because ruby can't know all the top-level domains.