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
Downloads yiffer.xyz comics as images

yiffer-dl Downloads comics as images from yiffer.xyz.

Maxim 2 Mar 20, 2022
Automatically download and crop key information from the arxiv daily paper. (cpu version)

Automatically download and crop key information from the arxiv daily paper. (cpu version)

HeoLis 4 Jul 30, 2022
Download YouTube videos that are available in the given playlist

Youtube-Playlist-Downloader Download YouTube videos that are in a playlist Project assets: music downloaded music folder. (will be generated) music.db

Sultan Aljaberi 1 Dec 22, 2021
Fully automated download and parsing for Texas A&M University's Registrar's grade distribution PDFs for years 2014+.

Fully automated download and parsing for Texas A&M University's Registrar's grade distribution PDFs for years 2014+. Adds the parsing results to a mySQL database.

TAMU Grade Distribution 1 Sep 28, 2022
A web app for downloading Facebook comments as a csv file

Facebook Comment Downloader A small web app for downloading comments from a public facebook page post. Comment downloading from https://github.com/min

WSDOT 23 Jan 04, 2023
A Celery application to collect data, download media and extract information from social media APIs

Project IBEX A Celery application to collect data, download media and extract information from social media APIs. Requirements You must have a Redis D

ibex 4 Dec 15, 2022
Downloader Middleware to support Playwright in Scrapy & Gerapy

Gerapy Playwright This is a package for supporting Playwright in Scrapy, also this package is a module in Gerapy. Installation pip3 install gerapy-pla

Gerapy 85 Dec 31, 2022
Download history data from binance and save to dataframe or csv file

Binance history data downloader Download history data from binance and save to dataframe or csv file

10 Dec 02, 2022
YT-Downloader is a Tool to download youtube video.

YT-Downloader YT-Downloader is a Tool to download youtube video.If you are looking for a simple video downloader tool Than This YT-Downloader may be u

Pradip Thapa 7 May 11, 2022
Python Youtube Video-Playlist Downloader

Youtube-Video-Playlist-Downloader-PyQt5 You can download videos and playlists on YouTube with this script. Script has GUI. Enjoy. Setup git clone http

Yunus Emre Öztürk 2 Jun 06, 2022
This simple Python script allows you to download songs on Telegram🌸❤️😁

SongsDownloaderTgBot 📺 YouTube Song Downloader Bot For Telegram 🔮 3X Fast Telethon Based Bot ⚜ Open Source Bot 👨🏻‍💻 Demo : 𝗔𝗻𝗻𝗶𝗲 - 𝗘𝗹𝗶𝘇?

Sehath Perera 23 Dec 03, 2022
Script that allows to download portable installers of different versions Adobe software for macOS

What is this and for what This is a script that allows you to download portable installers of programs from Adobe for macOS with different versions. T

715 Jan 06, 2023
1Fichier Download Manager.

1fichier-dl 1Fichier Download Manager. Features ⭐ Manage your downloads ⭐ Bypass time limits Credits All icons, including the app icon, were provided

manuGMG 470 Oct 08, 2022
Download all games from a public Itch.io Game Jam

Itch Jam Downloader Downloads all games from a public Itch.io Game Jam. What you'll need: Python 3.8+ pip install -r requirements.txt For site mirrori

Dragoon Aethis 19 Dec 07, 2022
Download all games from a public Itch.io Game Jam

Itch Jam Downloader Downloads all games from a public Itch.io Game Jam. What you'll need: Python 3.8+ pip install -r requirements.txt For site mirrori

Dragoon Aethis 19 Dec 07, 2022
Youtube playlist downloader with full metadata support

ytrake GUI tool to embed metadata for albums on Youtube with youtube-dl. Requires youtube-dl v2021.06.06. Post-processing Album metadata: Usage ytrake

28 Jul 12, 2022
Python script for downloading audio from YouTube songs/videos.

Python script for downloading audio from YouTube songs/videos. All you have to do is specify the path to your folder and then type song's/video's name and the sound will be downloaded into your folde

Mateusz Polis 0 Oct 05, 2022
Itchio Downloader Tool with python

Itchio Downloader Tool Install pip install git+https://github.com/emersont1/itchio Download All Games in library from account python -m itchio.downloa

Peter Taylor 69 Dec 05, 2022
YouTube Video publisher using youtube-dl & ROS2🐢

YouTube-publisher-ROS2 Publish sensor_msgs/Image by "YouTube" 🤗 🤗 🤗 ! You don't have to use webcamera or your video to check demos. Purpose Quick d

Ar-Ray 5 Dec 04, 2022
Download songs and playlists from Spotify for free!

spotify-to-mp3-converter You can basically understand the process with just this image but for clarity, these are the steps. Before using the exe down

2 Jan 25, 2022