there is a space after the word Part in the file name I want to download. It looks like http.get doesn't pass the url_path correctly because you can download the file from the browser without any troubles.
any suggestion how I can download a file if there is a space in the file name?
require 'net/http'
url = "http://www.onalllevels.com/2009-12-02TheYangShow_Squidoo_Part 1.flv"
puts url_base = url.split('/')[2]
puts url_path = '/'+url.split('/')[3..-1].join('/')
Net::HTTP.start(url_base) do |http|
resp = http.get(url_path)
open("test.flv", "wb") do |file|
file.write(resp.body)
end
end
puts "Done."