Skip to content

KTS-o7/better_bing_image_downloader

Repository files navigation

Better Bing Image Downloader

Table of Contents

Disclaimer

This program lets you download tons of images from Bing. Please do not download or use any image that violates its copyright terms.

GitHub top language GitHub Hits

Installation

git clone https://github.com/KTS-o7better_bing_image_downloader
python -m venv ./env
source env/bin/activate
cd better_bing_image_downloader
pip install .

or

pip install better-bing-image-downloader

PyPi

Package Link

Usage

Using as a Package:

from better_bing_image_downloader import downloader

downloader(query_string, limit=100, output_dir='dataset', adult_filter_off=True,
force_replace=False, timeout=60, filter="", verbose=True, badsites= [], name='Image')

query_string : String to be searched.
limit : (optional, default is 100) Number of images to download.
output_dir : (optional, default is 'dataset') Name of output dir.
adult_filter_off : (optional, default is True) Enable of disable adult filteration.
force_replace : (optional, default is False) Delete folder if present and start a fresh download.
timeout : (optional, default is 60) timeout for connection in seconds.
filter : (optional, default is "") filter, choose from [line, photo, clipart, gif, transparent]
verbose : (optional, default is True) Enable downloaded message.
bad-sites : (optional, defualt is empty list) Can limit the query to not access the bad sites.
name : (optional, default is 'Image') Can add a custom name for the images that are downloaded.

Using as a Command Line Tool:

    git clone https://github.com/KTS-o7/better_bing_image_downloader.git
    cd better_bing_image_downloader
    python -m venv ./env
    source env/bin/activate
    pip install -r requirements.txt
    cd better_bing_image_downloader
    # This is an example query
    python multidownloader.py "cool doggos" --engine "Bing"  --max-number 50 --num-threads 5 --driver "firefox_headless"

Command Line Arguments:

multidownloader.py "keywords" [-h] [--engine {Google,Bing}] [--driver {chrome_headless,chrome,api,firefox,firefox_headless}] [--max-number MAX_NUMBER] [--num-threads NUM_THREADS] [--timeout TIMEOUT] [--output OUTPUT] [--safe-mode] [--face-only] [--proxy_http PROXY_HTTP] [--proxy_socks5 PROXY_SOCKS5] [--type {clipart,linedrawing,photograph}] [--color COLOR]
  • "keywords": Keywords to search. ("in quotes")
  • -h, --help: Show the help message and exit
  • --engine, -e: Image search engine. Choices are "Google" and "Bing". Default is "Bing".
  • --driver, -d: Image search engine. Choices are "chrome_headless", "chrome", "api", "firefox", "firefox_headless". Default is "firefox_headless".
  • --max-number, -n: Max number of images download for the keywords. Default is 100.
  • --num-threads, -j: Number of threads to concurrently download images. Default is 50.
  • --timeout, -t: Seconds to timeout when download an image. Default is 10.
  • --output, -o: Output directory to save downloaded images. Default is "./download_images".
  • --safe-mode, -S: Turn on safe search mode. (Only effective in Google)
  • --face-only, -F: Only search for faces.
  • --proxy_http, -ph: Set http proxy (e.g. 192.168.0.2:8080)
  • --proxy_socks5, -ps: Set socks5 proxy (e.g. 192.168.0.2:1080)
  • --type, -ty: What kinds of images to download. Choices are "clipart", "linedrawing", "photograph".
  • --color, -cl: Specify the color of desired images.
# Example usage
python multidownloader.py "Cool Doggos" --engine "Google" --driver "chrome_headless" --max-number 50 --num-threads 10 --timeout 60 --output "./doggo_images" --safe-mode --proxy_http "192.168.0.2:8080" --type "photograph" --color "blue"

Star History

Star History Chart

License

This project is licensed under the terms of the MIT license.

Contact

If you have any questions or feedback, please contact us at email.