I have used google image api in python to download 20 first image result with the following code:
import os
import sys
import time
from urllib import FancyU
You can use this Google APIs Client Library for Python.
Demo:
Here is a sample (i change it to):
from apiclient.discovery import build
service = build("customsearch", "v1",
developerKey="** your developer key **")
res = service.cse().list(
q='butterfly',
cx=' ** your cx **',
searchType='image',
num=3,
imgType='clipart',
fileType='png',
safe= 'off'
).execute()
if not 'items' in res:
print 'No result !!\nres is: {}'.format(res)
else:
for item in res['items']:
print('{}:\n\t{}'.format(item['title'], item['link']))
Output:
Clipart - Butterfly:
http://openclipart.org/image/800px/svg_to_png/3965/jonata_Butterfly.png
Animal, Butterfly, Insect, Nature - Free image - 158831:
http://pixabay.com/static/uploads/photo/2013/07/13/11/51/animal-158831_640.png
Clipart - Monarch Butterfly:
http://openclipart.org/image/800px/svg_to_png/110023/Monarch_Butterfly_by_Merlin2525.png
Yes, there is a limitation for Free
edition and you can monitor it from Google developer console:
Note:
Go to your Custom Search Engine, then select your custom search engine, then in Basics tab,
set Image search
option to ON
, and for Sites to search
section, select Search the entire web but emphasize included site
option.
Links:
I have search api for downloading images to create data set of images may be you should have a look at these !
https://rapidapi.com/contextualwebsearch/api/web-search?endpoint=5b864ca4e4b085e3f407ecca
https://github.com/hardikvasa/webb/blob/master/docs/Documentation.md
From documentation i like the 2nd one to perfect !