N
Nathaniel Escribano
[Note: parts of this message were removed to make it a legal post.]
I am trying to write a simple script that downloads a music file from the
internet.
For example: if i want to download
http://cdn.stereogum.com/mp3/My Morning Jacket - Celebration (Live).mp3
how exactly would you do it?
I found someone who was able to download a flickr photo using this script:
require 'net/http'
Net::HTTP.start("farm1.static.flickr.com") { |http|
resp = http.get("/92/218926700_ecedc5fef7_o.jpg")
open("fun.jpg", "wb") { |file|
file.write(resp.body)
}
}
puts 'Downloaded'
With a slight modification shouldn't this work for the music file?
What makes downloading a photo any different than an mp3 file?
require 'net/http'
Net::HTTP.start("cdn.stereogum.com") { |http|
resp = http.get("/mp3/My Morning Jacket - Celebration (Live).mp3")
open("Celebration.mp3", "wb") { |file|
file.write(resp.body)
}
}
puts "the song has been downloaded"
Why doesn't it work? What needs to be changed?
Any help would be great! Thanks.
I am trying to write a simple script that downloads a music file from the
internet.
For example: if i want to download
http://cdn.stereogum.com/mp3/My Morning Jacket - Celebration (Live).mp3
how exactly would you do it?
I found someone who was able to download a flickr photo using this script:
require 'net/http'
Net::HTTP.start("farm1.static.flickr.com") { |http|
resp = http.get("/92/218926700_ecedc5fef7_o.jpg")
open("fun.jpg", "wb") { |file|
file.write(resp.body)
}
}
puts 'Downloaded'
With a slight modification shouldn't this work for the music file?
What makes downloading a photo any different than an mp3 file?
require 'net/http'
Net::HTTP.start("cdn.stereogum.com") { |http|
resp = http.get("/mp3/My Morning Jacket - Celebration (Live).mp3")
open("Celebration.mp3", "wb") { |file|
file.write(resp.body)
}
}
puts "the song has been downloaded"
Why doesn't it work? What needs to be changed?
Any help would be great! Thanks.