Python library to download bulk of images from Bing.com

Overview

GitHub top language GitHub Hits

Bing Image Downloader


Python library to download bulk of images form Bing.com. This package uses async url, which makes it very fast while downloading.

Disclaimer

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

Installation

pip install bing-image-downloader

or

git clone https://github.com/gurugaurav/bing_image_downloader
cd bing_image_downloader
pip install .

Usage

from bing_image_downloader import downloader
downloader.download(query_string, limit=100,  output_dir='dataset', adult_filter_off=True, force_replace=False, timeout=60, verbose=True)

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.
verbose : (optional, default is True) Enable downloaded message.

PyPi

https://pypi.org/project/bing-image-downloader/


Donate

You can buy me a coffee if this project was helpful to you.

Show your support

Comments
  • Not working anymore

    Not working anymore

    Hello, I have been using the python package for months without problems, but for a few weeks the downloaded images have no relation to the search tag and the downloads are repeated cyclically.

    I mean if i search for example "box" and try to download 50 images. There are many images that are not related to boxes, and every 8 images they repeat.

    opened by jesgarm 3
  • ImportError

    ImportError

    Hi, if I use bing.py and downloader.py outside the package they work perfectly. But if I import as it is in the instructions it generates ImportError: cannot import name downloader from partially initialized module bing_image_downloader.

    opened by ggc161169 3
  • Allow to specify output folder for downloading images

    Allow to specify output folder for downloading images

    Currently the script downloads the images to a dataset folder in the repo. This is not always desirable.

    Modify the signature of downloader.download to specify the output_dir for image downloads.

    opened by xssChauhan 2
  • There should be an option to use an absolute path as out_dir

    There should be an option to use an absolute path as out_dir

    It would be really useful if out_dir wasn't always appended to os.getcwd(). I think there should be a simple boolean absolute_path for people who want to use their own absolute path.

    opened by Finni123 1
  • Path problems

    Path problems

    Hello!, when I put a destination folder the script tries to generate a folder with the name of the path I indicated, for example if I put in path "C:" it doesn't locate the images in that path but tries to create a folder called C:\ which generates an error, is there a way to solve this?

    Is there also a way to rename the downloaded file and not generate a folder with the name of each search but keep them all in the same folder?

    Thank you very much!

    opened by Johanfer12 1
  • During handling of the above exception, another exception occurred:

    During handling of the above exception, another exception occurred:

    Do you know how to fix this error?

    I was hoping to download 50k images but only 7000 images got downloaded.

    [!!]Indexing page: 56
    
    Traceback (most recent call last):
      File "/home/mona/anaconda3/lib/python3.7/urllib/request.py", line 1319, in do_open
        encode_chunked=req.has_header('Transfer-encoding'))
      File "/home/mona/anaconda3/lib/python3.7/http/client.py", line 1252, in request
        self._send_request(method, url, body, headers, encode_chunked)
      File "/home/mona/anaconda3/lib/python3.7/http/client.py", line 1298, in _send_request
        self.endheaders(body, encode_chunked=encode_chunked)
      File "/home/mona/anaconda3/lib/python3.7/http/client.py", line 1247, in endheaders
        self._send_output(message_body, encode_chunked=encode_chunked)
      File "/home/mona/anaconda3/lib/python3.7/http/client.py", line 1026, in _send_output
        self.send(msg)
      File "/home/mona/anaconda3/lib/python3.7/http/client.py", line 966, in send
        self.connect()
      File "/home/mona/anaconda3/lib/python3.7/http/client.py", line 1414, in connect
        super().connect()
      File "/home/mona/anaconda3/lib/python3.7/http/client.py", line 938, in connect
        (self.host,self.port), self.timeout, self.source_address)
      File "/home/mona/anaconda3/lib/python3.7/socket.py", line 707, in create_connection
        for res in getaddrinfo(host, port, 0, SOCK_STREAM):
      File "/home/mona/anaconda3/lib/python3.7/socket.py", line 752, in getaddrinfo
        for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
    socket.gaierror: [Errno -3] Temporary failure in name resolution
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "download_images_from_bing.py", line 2, in <module>
        downloader.download('gun', limit=50000, adult_filter_off=True, force_replace=False)
      File "/home/mona/anaconda3/lib/python3.7/site-packages/bing_image_downloader/downloader.py", line 34, in download
        Bing().bing(query, limit, adult)
      File "/home/mona/anaconda3/lib/python3.7/site-packages/bing_image_downloader/bing.py", line 63, in bing
        response = urllib.request.urlopen(request)
      File "/home/mona/anaconda3/lib/python3.7/urllib/request.py", line 222, in urlopen
        return opener.open(url, data, timeout)
      File "/home/mona/anaconda3/lib/python3.7/urllib/request.py", line 525, in open
        response = self._open(req, data)
      File "/home/mona/anaconda3/lib/python3.7/urllib/request.py", line 543, in _open
        '_open', req)
      File "/home/mona/anaconda3/lib/python3.7/urllib/request.py", line 503, in _call_chain
        result = func(*args)
      File "/home/mona/anaconda3/lib/python3.7/urllib/request.py", line 1362, in https_open
        context=self._context, check_hostname=self._check_hostname)
      File "/home/mona/anaconda3/lib/python3.7/urllib/request.py", line 1321, in do_open
        raise URLError(err)
    urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
    
    
    from bing_image_downloader import downloader
    downloader.download('cat', limit=50000, adult_filter_off=True, force_replace=False)
    
    opened by monajalal 1
  • Error:: 'ascii' codec can't encode character '\xf1' in position 46: ordinal not in range(128)

    Error:: 'ascii' codec can't encode character '\xf1' in position 46: ordinal not in range(128)

    've tried this yesterday with a couple of queries and it worked completely regulary. But today it is showing some error -

    [%] Downloading Image #4 from http://www.zacatecasalminuto.com/wp-content/uploads/2020/05/cierra_mina_peñoles_morelos_zac.png [!] Issue getting: http://www.zacatecasalminuto.com/wp-content/uploads/2020/05/cierra_mina_peñoles_morelos_zac.png [!] Error:: 'ascii' codec can't encode character '\xf1' in position 46: ordinal not in range(128)

    opened by Beowulfdgo 0
  • Please don't ignore other filters

    Please don't ignore other filters

    All explicitly specified Filters other than this small set of list of shorthands are being ignored. In earlier version it wasn't so. Please don't ignore them.

    opened by ishandutta2007 0
  • Add page limit option

    Add page limit option

    I've noticed when downloading over 30 images or so, sometimes it just can't find more, and it keeps indexing the pages without any success. To counter this, I added a page_limit option that limits the number of pages it indexes. I changed the README as well to include this option, and I also added some prints to show whether it stopped because of the download limit or the page limit.

    opened by MilanVarady 6
  • Worked fine yesterday, but showing error for me today.

    Worked fine yesterday, but showing error for me today.

    I've tried this yesterday with a couple of queries and it worked completely fine. But today it is showing some error -

    Traceback (most recent call last):
      File "E:\Pyhon\bing.py", line 1, in <module>
        from bing_image_downloader import downloader
      File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\bing_image_downloader\downloader.py", line 6, in <module>
        from bing import Bing
      File "E:\Pyhon\bing.py", line 2, in <module>
        downloader.download('apricot', limit=100,  output_dir='dataset', adult_filter_off=True, force_replace=False, timeout=60, verbose=True)
    AttributeError: partially initialized module 'bing_image_downloader.downloader' has no attribute 'download' (most likely due to a circular import)
    
    Process finished with exit code 1
    
    opened by paulaai 3
Releases(relaase)
  • relaase(Feb 10, 2022)

    What's Changed

    • Added an option to let the user disable the downloaded message of each image by @Eugene-Lam in https://github.com/gurugaurav/bing_image_downloader/pull/15
    • 1.1.0 by @gurugaurav in https://github.com/gurugaurav/bing_image_downloader/pull/16
    • Create python-publish.yml by @gurugaurav in https://github.com/gurugaurav/bing_image_downloader/pull/17
    • fix duplicate images by @sid7631 in https://github.com/gurugaurav/bing_image_downloader/pull/20
    • Add support for using filters by @steenstra in https://github.com/gurugaurav/bing_image_downloader/pull/22

    New Contributors

    • @Eugene-Lam made their first contribution in https://github.com/gurugaurav/bing_image_downloader/pull/15
    • @gurugaurav made their first contribution in https://github.com/gurugaurav/bing_image_downloader/pull/16
    • @sid7631 made their first contribution in https://github.com/gurugaurav/bing_image_downloader/pull/20
    • @steenstra made their first contribution in https://github.com/gurugaurav/bing_image_downloader/pull/22

    Full Changelog: https://github.com/gurugaurav/bing_image_downloader/commits/relaase

    Source code(tar.gz)
    Source code(zip)
Owner
Guru Prasad Singh
Machine Learning Engineer.
Guru Prasad Singh
Download and save Bing wallpapers and set as background for GNOME desktop

Save Bing wallpapers and set as background for GNOME desktop This script downloads the Bing wallpaper and sets it in the background of your gnome desk

manikamran 2 Nov 6, 2021
Download Web-10K data by querying Bing Image Search

gpv2-web10k This repository contains the script to download images from the Web-10K dataset. The script takes in a list of queries, queries Bing Image

AI2 8 Sep 6, 2022
A simple python script to fetch Bing daily images and set them randomly using hsetroot

Daily bing walls A script to set the daily bing image as the wallpaper. It can also set from a random set of previously fetched wallpapers. usage: dai

Harinarayanan K S 5 Nov 23, 2022
Bulk Downloader for Reddit

saveddit is a bulk media downloader for reddit pip3 install saveddit Setting up authorization Register an application with Reddit Write down your clie

Pranav 136 Jan 3, 2023
Python script to download all images/webms of a 4chan thread

Python3 script to continuously download all images/webms of multiple 4chan thread simultaneously - without installation

Micha Fink 208 Jan 4, 2023
python code used to download all images contained in a facebook uid , the uid can be profile,group,fanpage

python code used to download all images contained in a facebook uid , the uid can be profile,group,fanpage

VVHai 2 Dec 21, 2021
Python script to download entire campaign images and navigation.

Squidle campaign downloader Python script to download entire campaign images and navigation. usage: squidle_campaign_downloader.py [-h] [--api-token A

Miquel Massot 2 Nov 17, 2021
Download images where login is required using har python and js

이미지 다운로드(har, python, js 사용) 로그인이 필요한 사이트에서 DevTools로 이미지를 다운받는 방법은 조금 까다로웠다. 가장 쉽게 할 수 있는 방법을 찾아보았다. 사용법 F12를 눌러 DevTools를 실행 Network 탭으로 이동 페이지 새로고침

null 0 Jul 22, 2022
Simple Python script to download images and videos from public subreddits without using Reddit's API 😎

Subreddit Media Downloader Download images and videos from any public subreddit without using Reddit's API Made with ❤ by Nico ?? About: This script a

Nico 106 Jan 7, 2023
Used Insta Loader to download high quality images from instagram account

Insta Dp Downloader Project Description: In this project, I have used "Insta Loader" to download high quality images from instagram account. You only

Hassan Shahzad 3 Oct 31, 2022
Download YouTube videos/music and images in MP4, JPG with this tool.

ABOUT THE TOOL Download YouTube videos, music and images in MP4, JPG with this tool, with an easy to understand interface. This tool works with both,

TrollSkull 5 Jan 2, 2023
A tool written in Python to download all Snapmaps content from a specific location.

snapmap-archiver A tool written in Python to download all Snapmaps content from a specific location.

null 46 Dec 9, 2022
The free and open-source Download Manager written in pure Python

The free and open-source Download Manager written in pure Python

pyLoad 2.7k Dec 31, 2022
FireDM is a python open source (Internet Download Manager) with multi-connections, high speed engine, it downloads general files and videos from youtube and tons of other streaming websites .

python open source (Internet Download Manager) with multi-connections, high speed engine, based on python, LibCurl, and youtube_dl https://github.com/firedm/FireDM

null 1.6k Apr 12, 2022
This is a python based web scraping bot for windows to download all ACCEPTED submissions of any user on Codeforces

CODEFORCES DOWNLOADER This is a python based web scraping bot for windows to download all ACCEPTED submissions of any user on Codeforces Requirements

Mohak 6 Dec 29, 2022
Python script designed to search and fetch direct download links from nxbrew.com

SwitchGamesDownloader Only for windows nxbrew.com is a website, accessible only using a proxy, where the majority of games for the Nintendo Switch are

Backend 91 Dec 28, 2022
A Python script that allows you to download all of an anime's episodes at once.

BitAnime A Python script that allows you to download all of an anime's episodes at once. · Download executable version · About BitAnime BitAnime is a

sh1nobu 17 Aug 10, 2022
Download videos and audio with a graphical interface in python

Youtube-Downloader Download videos and audio with a graphical interface in python Windows To run windows using Command Prompt python main.py linux To

null 2 Jan 7, 2022