How to save Google search images with a single command

ichii731

Ichi

Posted on February 22, 2021

How to save Google search images with a single command

Around August 2020, the method of providing results in Google search seems to have 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".

Installation

[Caution] Do not install with pip!
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
Enter fullscreen mode Exit fullscreen mode

This completes the installation.

How to use

Here, as a typical usage, the usage method on the command line is listed.

googleimagesdownload --keywords "apple" --limit 20
Enter fullscreen mode Exit fullscreen mode

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.

When acquiring 100 or more

If you want to get more than 100 images, you need to install chrome driver.

  • This is the operation method for Ubuntu 20.04 LTS. For Windows, please check by yourself m (_ _) m

First check the latest version of the driver
Please go to the following site and copy the latest version of "chromedriver_linux64.zip" URl.

Then enter the following command in succession. (I referred to this article.)

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
Enter fullscreen mode Exit fullscreen mode

This completes the installation.

Command to get 100 or more

googleimagesdownload --keywords "apple" --limit 120 --chromedriver /usr/local/bin/chromedriver
Enter fullscreen mode Exit fullscreen mode

Just select the installation destination with the --chromedriver option for the one I introduced earlier.

↓ Acquisition result
Alt Text

You have obtained it properly.
Alt Text

I've written a lot, so please take a look at my blog.

💖 💪 🙅 🚩
ichii731
Ichi

Posted on February 22, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related