[LINUX] [Latest] How to use Python library to save Google image search & use Chrome Driver on ubuntu

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" **.

Installation

** [Caution] Do not install with pip! ** **

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.

How to use

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.

When acquiring 100 or more

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 image.png 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 image.png

You have obtained it properly. image.png

Recommended Posts

[Latest] How to use Python library to save Google image search & use Chrome Driver on ubuntu
How to run matplotlib on heroku
How to use Google Assistant on Windows 10
How to search Google Drive with Google Colaboratory
How to scrape websites created with SPA
Save the search results on Twitter to CSV.
[Latest] How to use Python library to save Google image search & use Chrome Driver on ubuntu
How to use Python Image Library in python3 series
How to use Django on Google App Engine / Python
How to use Requests (Python Library)
How to use Google Assistant on Windows 10
[Latest] How to build Java environment on Ubuntu
How to run MeCab on Ubuntu 18.04 LTS Python
How to use PyTorch-based image processing library "Kornia"
[2020.8 latest] How to install Python
Use matplotlib on Ubuntu 12 & Python
python3: How to use bottle (2)
[Python] How to use list 1
How to use Python argparse
Python: How to use pydub
[Python] How to use checkio
[Python] How to use input ()
How to use Python lambda
[Python] How to use virtualenv
python3: How to use bottle (3)
python3: How to use bottle
How to use Google Colaboratory
How to use Python bytes
How to use Fujifilm X-T3 as a webcam on Ubuntu 20.04
How to build a new python virtual environment on Ubuntu
[python] How to use the library Matplotlib for drawing graphs
[Hyperledger Iroha] Notes on how to use the Python SDK
[Ev3dev] How to display bmp image on LCD with python
Notes on how to use marshmallow in the schema library
Python: How to use async with
[Python] How to use Pandas Series
How to use SQLite in Python
Notes on how to use pywinauto
Notes on how to use featuretools
How to use python put in pyenv on macOS with PyCall
How to build a Python environment using Virtualenv on Ubuntu 18.04 LTS
How to use homebrew on Debian
[Python] How to import the library
[Memo] How to use Google MµG
[Python] How to use list 3 Added
How to use Mysql in python
How to use OpenPose's Python API
How to use ChemSpider in Python
How to use FTP with Python
Python: How to use pydub (playback)
How to automatically install Chrome Driver for Chrome version with Python + Selenium + Chrome
How to use bing search api
How to use python zip function
Notes on how to use doctest
How to install Go on Ubuntu
[Python] How to use Typetalk API
Steps to run Google Chrome headless on EC2 Ubuntu and take screenshots
How to use hmmlearn, a Python library that realizes hidden Markov models
Add words to MeCab's user dictionary on Ubuntu for use in Python
[Python] Summary of how to use pandas
[Introduction to Python] How to use class in Python?
How to read pydoc on python interpreter
How to install and use pandas_datareader [Python]
[Kivy] How to install Kivy on Windows [Python]
How to use mecab, neologd-ipadic on colab
How to update Google Sheets from Python