patryklaskowski / Google_Image_Downloader

Script downloads images from Google Images.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

google_image_downloader.py

build with Python 3.7.4


This script downloads images from Google Images based on provided --search SEARCH_TERM and --amount AMOUNT.
By default script is running Google Chrome. But You may run the program headless using --headless flag.
Imges will be saved in folder with SEARCH_TERM name that will be created where google_image_downloader.py is located.

NOTE: If folder named SEARCH_TERM exists in google_image_downloader.py location, script removes it with all content and creates new one.


How to use?
python3 google_image_downloader.py --search SEARCH_TERM --amount N

  1. Make sure there is proper chromedriver in chromedriver_folder.
    There is already one zip file with chromedriver for MacOS, unzip and done!
    If you need different chromedriver, download it here.

  2. Make sure that dependencies are installed and ready to use (requirements.txt).

  3. Run script using Python3 (see examples below).



Examples:

  • Download 30 images of 'snowboard' using headless browser:
    python3 google_image_downloader.py --search snowboard --amount 30 --headless

  • Download 5 images of 'apple cortland' without headless mode:
    python3 google_image_downloader.py --search apple cortland --amount 5


3 types of flags ready to use:

  • --search : determines search term
  • --amount : determines amount of images to download
  • --headless : determine headless browser run when provided

Modules used:

  • selenium
  • requests
  • os
  • shutil
  • time
  • sys


About

Script downloads images from Google Images.


Languages

Language:Python 100.0%