Hi,
I'm developing a program to fetch the html contents of a site using
'net/http'. Everyting works fine except for http://www.youtube.com. When
i pass that url an error like this is found

/usr/lib/ruby/1.8/net/http.rb:2097:in `error!': 400 "Bad Request"
(Net::HTTPServerException)

I think it is because i'm not using any user agent. Can any body please
tell me any auggestion. I'll be really greatful. This is my code
snippet.

response = Net::HTTP.get_response(URI.parse("http://www.youtube.com"))
                    case response
                        when Net::HTTPSuccess     then response
                        when Net::HTTPRedirection then response =
Net::HTTP.get(URI.parse(response['location']))
                    else
                        response.error!
                    end

Thanks

regards
Arun Kumar
-- 
Posted via http://www.ruby-forum.com/.