Let's say that I want to download this picture using ruby. How do I do that?
http://farm1.static.flickr.com/92/218926700_ecedc5fef7_o.jpg
I am using mac.
Let's say that I want to download this picture using ruby. How do I do that?
http://farm1.static.flickr.com/92/218926700_ecedc5fef7_o.jpg
I am using mac.
require "open-uri"
open("your-url") {|f|
File.open("whatever_file.jpg","wb") do |file|
file.puts f.read
end
}
%x(wget http://farm1.static.flickr.com/92/218926700_ecedc5fef7_o.jpg)
or
`wget http://farm1.static.flickr.com/92/218926700_ecedc5fef7_o.jpg`
The easiest way would be to require open-uri
and use that with the previous answer or use the also supplied Net::HTTP module with its get method.