How to download random pictures

Thanks Rhode Island Narragansett School System for the awesome avatar for this post!

As CloudBerry Lab engineer sometimes I run stress tests for Backup and Explorer product portfolio and it requires a lot of data. The below script helps me to fetch google through GCP APIs for images with certain content. See how I get thousand giraffes for in my local folder.

All you need:

require 'google_custom_search_api'
require "open-uri"
require 'json'


options = {}
options[:searchType] = "image"
page = 1

10.times do |page|
  options[:page] = page
  results ="giraffe", options)
  results["items"].each do |item|
    download = open(item["link"])
    puts item["link"]
    IO.copy_stream(download, "images/#{download.base_uri.to_s.split('/')[-1]}")
  # page++
  # puts JSON.pretty_generate results

You can convert this to Python and use along with serverless architecture (for instance Lambda in AWS). Should be fun!

In short, this is about:

Start discussion:
Related articles:
Cloudberry 1.8 for Mac OS X is now live! Impressive list of features and storage platforms support! S3 compatible, new UI and etc. ... more
over 5 years#cloudberrylab #mac
Asterisk IP PBX comes with embedded MixMonitor, that allows us to to record and place those recordings somewhere. ... more
One of the evening I spend on parsing xml content with 1000+ pages. grep, awk, sed were awesome, but the head were getting bigger with massive number of regex's, so nokogiri made it easier. ... more
over 5 years#nokogiri #ruby
Amazon Web Services (AWS) has its own AWS Linux AMI (also free tier). There are several reasons you want to use this AMI for your projects. ... more
Working with customers is great experience and you always learn or invent something new. I've been working on the case with files portioning ... more
In this article you'll learn how to protect your data against hardware and software failures according to the 3-2-1 rule. ... more
Since FullAccess is disabled even for Administrator's account in Exchange (including 2010) CloudBerry Backup for Exchange can't restore using Administrator's username and password pair for item level restore of any mailbox. Let's fix it. ... more
Launching AWS EC2 can be supplied by something what is known as "user data" and it helps to have things ready before you access it. ... more
How to pre-deploy App using user data script for Windows OS with powershell powered script in EC2? Example inside. ... more
In this short article you will learn how to use PsExec with remote powershell script to download, execute and clean up software. You can do it for multiple computers in super easy way. ... more
Here at CloudBerry, where one of the goal I have is to help partners decide, pick and build right configurations for dealing with computers data when they need backup solution. FTP, SCP, WebDav and some other proprietary protocols have been here forever, where simplicity and flexibility made them number one in data protection and management fields as primary target configurations. But, there is big BUT... ... more