get first image from google search python code example
Example: python google image search
from google_images_search import GoogleImagesSearch
gis = GoogleImagesSearch('your_dev_api_key', 'your_project_cx')
_search_params = {
'q': '...',
'num': 10,
'safe': 'high|medium|off',
'fileType': 'jpg|gif|png',
'imgType': 'clipart|face|lineart|news|photo',
'imgSize': 'huge|icon|large|medium|small|xlarge|xxlarge',
'imgDominantColor': 'black|blue|brown|gray|green|pink|purple|teal|white|yellow',
'rights': 'cc_publicdomain|cc_attribute|cc_sharealike|cc_noncommercial|cc_nonderived'
}
gis.search(search_params=_search_params)
gis.search(search_params=_search_params, path_to_dir='/path/')
gis.search(search_params=_search_params, path_to_dir='/path/', width=500, height=500)
gis.search(search_params=_search_params)
for image in gis.results():
image.download('/path/')
image.resize(500, 500)