This package provides functions to download images using duckduckgo images search.
pip install git+https://github.com/butchland/ddg_images_downloader.git
Install chromium and chromedriver
In order to run the package, you need to install chromium and chromedriver If you are running on linux, you can install chromium and chrome driver using the
apt
tool.!apt-get update !apt install chromium-chromedriver
If on other OS (Mac or Windows), please see instructions on setting up chrome driver with Selenium on your platform. See Chrome Driver Getting Started for details.
Import library
from pathlib import Path
from fastcore.utils import *
from ddg_images_downloader.images import *
bear_types = ['teddy','black']
path = Path('bears')
!rm -rf bears
download_search_urls(path, bear_types,'{0} bear',scroll_count=4,sleep=5)
!ls -ald {path.as_posix()}/*
download_search_images_slowly(path,bear_types)
Retrieve image urls into a file
!mkdir fruits
download_search_url('passion fruit',Path('fruits')/'passion.txt',scroll_count=3)
Download the images into a folder
download_images_slowly(Path('fruits')/'passion',Path('fruits')/'passion.txt')