Download images from DuckDuckGo
Project description
DuckDuckGoImages
Instalation
To install run the following:
pip install DuckDuckGoImages
Usage
import using the following:
import DuckDuckGoImages as ddg
and then you can search and download images from DuckDuckGo using:
ddg.download('kittens')
The above command will search for the query phrase kittens
, and then will try to download the list of image urls into the current folder.
Each downloaded image will have a randomic UUIDv4 name.
Options
When downloading images you can pass download
the next list of parameters to achieve different results:
folder
: The path where the downloaded images are saved. Default is current directory.max_urls
: If set to a number, then only that amount of images will be downloaded. Note that the available images to download could be less thanmax_urls
. DefaultNone
, so all search results will try to be downloaded.thumbnails
: If set toTrue
, the image thumbnails will be downloaded instead of the actual image. This should avoid broken links, but it will also download a smaller image in most cases. DefaultNone
.parallel
: If set to true, then N jobs will be created to download the list of images faster, the number of jobs is the number of cpu procesors on the machine. DefaultFalse
.shuffle
: If set to true, the list of images will be shuffled randomly before download. DefaultFalse
.remove_folder
: If set to true, then the folder where the images will be downloaded is deleted before the download. DefaultFalse
.safe_search
: If set to true it will make a search with "safe search" enabled (Moderated value is the default on duckduckgo), a value of false will disable safe search entirely, use with caution. DefaultTrue
.licence
: If set to a value the result search will only retrieve images that have the specified licence. Usable values are defined as constants inside the package, so for use you should do something likeddg.download('kittens', licence=ddg.ALL)
, valid licence types are:- ALL: retrieve all images, this is the default behaviour.
- CREATIVE_COMMONS: This will only retrieve images that have the Creative Commons licence.
- PUBLIC_DOMAIN: This will only retrieve images that are on the public domain.
- SHARE_AND_USE: This will only retrieve images that can be shared and used.
- SHARE_AND_USE_COMMECIALLY: This will only retrieve images that can be shared and used commercially.
- MODIFY_SHARE_AND_USE: This will only retrieve images that can be modified, shared and used.
- MODIFY_SHARE_AND_USE_COMMERCIALLY: This will only retrieve images that can be modified, shared and used commercially.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file DuckDuckGoImages-2.0.8-py3-none-any.whl
.
File metadata
- Download URL: DuckDuckGoImages-2.0.8-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 126a28794bc3548b8ede346ddcd72f93a75cff0316ee5f39d85a99d3f9aa11dc |
|
MD5 | d5f7aab44509f27fdb9bba14cf1ee7a2 |
|
BLAKE2b-256 | c9e1f86b0fc2171792edefa9d53c4245555fd82ac8fecc2916a43007306bf521 |