def get_image(url)
open("img/#{File.basename(url)}", 'wb') do |file|
file.puts(Net::HTTP.get_response(URI.parse(url)).body)
end
end
保存場所は適当に変更してください。
More than 5 years have passed since last update.
def get_image(url)
open("img/#{File.basename(url)}", 'wb') do |file|
file.puts(Net::HTTP.get_response(URI.parse(url)).body)
end
end
保存場所は適当に変更してください。
Register as a new user and use Qiita more conveniently