happy New Year.
I'm sure many people know this, but I'll get lost many times, so I'll write it down. Please use it for learning data during machine learning.
Around August 2020? It seems that the method of providing search results has changed significantly, and the Windows software "ImageSpider" can no longer be used. (It was quite convenient, though ...) So from now on, I decided to use the Python library ** "google_images_download" **.
pip3 install google_images_download
The version in PIP does not support changes on the Google side, so it cannot be used even if it is installed. So install it directly.
git clone https://github.com/Joeclinton1/google-images-download.git
cd google-images-download && sudo python setup.py install
This completes the installation.
Here, as a typical usage, the usage method on the command line is listed.
googleimagesdownload --keywords "apple" --limit 20
In the above example, ** 20 ** search results for "** apple **" will be saved in the current directory. Please see ** Official Document *** for how to use it on Python and other condition settings.
If you want to get more than 100 images, you need to install ** chromedriver. ** **
** First check the latest version of the driver ** Please go to the following site and copy the latest version of "chromedriver_linux64.zip" URl. *https://sites.google.com/a/chromium.org/chromedriver/downloads By the way, as of January 6, 2021, it was https://chromedriver.storage.googleapis.com/88.0.4324.27/chromedriver_linux64.zip.
** Then continue typing the following command. ** (I referred to the article here.)
sudo apt install unzip
cd /tmp/
curl -O <<<<<Enter the URL you just confirmed here>>>>>
unzip chromedriver_linux64.zip
mv chromedriver /usr/local/bin/
rm chromedriver_linux64.zip
This completes the installation.
** Command to get 100 or more items **
googleimagesdownload --keywords "apple" --limit 120 --chromedriver /usr/local/bin/chromedriver
Just select the installation destination with the --chromedriver option for the one I introduced earlier.
↓ Acquisition result
You have obtained it properly.
Recommended Posts