From: Andrew Wagner Date: 2010-08-17T22:23:32+09:00 Subject: Re: HTTP Downloader --0016e6d975c72fccdd048e04d2bc Content-Type: text/plain; charset=UTF-8 Why are you trying to convert the subURL to an integer? That's what to_i does. What's the actual error you're getting? My guess is that HTTP is saying it can't find that page. You might want to try to trap that error, so you know better what's going on. On Tue, Aug 17, 2010 at 9:13 AM, Hd Pwnz0r wrote: > require 'net/http' > > puts "Enter the URL of the site you want to download from (You must have > http:// and www. if the site has it). e.g. http://www.google.com" > site = gets.chomp.to_s > > puts "Enter the sub-URL of the file you want to download. e.g. > /img/1.png" > subURL = gets.chomp.to_i > > puts "The file will download into the directory this script is placed > in." > > Net::HTTP.start("#{site}") { |http| > resp = http.get("#{subURL}") > open("fun.jpg", "wb") { |file| > file.write(resp.body) > } > } > puts "Done!" > > Again, an error. This time this script is for easily downloading videos > that play in the browser etc. > -- > Posted via http://www.ruby-forum.com/. > > --0016e6d975c72fccdd048e04d2bc--