Last active
September 30, 2019 16:57
-
-
Save aymericdelab/bc5068b588ac09cf7c640d8cb71ce5e1 to your computer and use it in GitHub Desktop.
Download google images using google_images_download
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from google_images_download import google_images_download\n", | |
"\n", | |
"downloader=google_images_download.googleimagesdownload()\n", | |
"\n", | |
"## if we want to retrieve more than 100 images from google drive we need to download chromedriver \n", | |
"## Change this path with the location of your chromedriver.exe \n", | |
"cd_path='C:\\Program Files\\chromedriver_win32\\chromedriver.exe'\n", | |
"output_dir=r'./data/google/'\n", | |
"\n", | |
"founders=['Jeff Bezos','Larry Page','Bill Gates']\n", | |
"\n", | |
"for founder in founders:\n", | |
" arguments = {\"keywords\":founder,\n", | |
" \"limit\":600,\n", | |
" \"print_urls\":True,\n", | |
" \"output_directory\":output_dir,\n", | |
" \"chromedriver\":cd_path,\n", | |
" \"format\":'jpg',\n", | |
" \"type\": 'face'}\n", | |
" paths = downloader.download(arguments) #passing the arguments to the function\n", | |
" print(paths) #printing absolute paths of the downloaded images" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "sagemaker", | |
"language": "python", | |
"name": "sagemaker" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.6.9" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment