Skip to content

Instantly share code, notes, and snippets.

@stefanoverna
Created June 21, 2017 12:15
Show Gist options
  • Select an option

  • Save stefanoverna/1e29201e9f23ae35f0b1603066555b62 to your computer and use it in GitHub Desktop.

Select an option

Save stefanoverna/1e29201e9f23ae35f0b1603066555b62 to your computer and use it in GitHub Desktop.
require "bundler/setup"
require "unsplash"
Unsplash.configure do |config|
config.application_id = "93bf60230c4c3a9eeb002bfbc2b417b473e9afc2c47eda0482e3688934d3eaeb"
config.application_secret = "c1f305a1a625d14a5595f6bf06db5e2895cc751d30ba8515aa5ca611a5436408"
end
counter = 0
10.times do
search_results = Unsplash::Photo.random(count: 30)
search_results.each do |photo, i|
counter += 1
`wget '#{photo.urls.regular}' -O random-#{counter}.jpg`
end
end
source "https://rubygems.org"
gem "unsplash"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment