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
Vinetrimmer-DRM-TOOL - Widevine DRM downloader and decrypter for AMZN|NF|STAN And all

🍃 ✂️ Vinetrimmer Widevine DRM downloader and decrypter. Thanks to wvleaks for t

Vlad Tănăsescu 20 Jan 13, 2022
This package helps you to directly download an APK from Google Play by providing the package id of the app

Apk Downloader About | Features | Technologies | Requirements | Starting | License | Author 🎯 About This package helps you to directly download an AP

Daniel Agyapong 9 Dec 11, 2022
Python based Telegram bot. Search and download YouTube video or audio.

Python-Telegram-Youtube-Media-Bot Python based Telegram bot. Search and download YouTube video or audio. Just change settings.py and start TelegramBot

Ahmet Bohur 2 Oct 02, 2022
Downloads photos you saved from a specific profile.

instagram-download-saved A python script that downloads photos you saved from a specific profile. The only dependency is instaloader, an open-source p

Aviv 1 Dec 19, 2021
Spotify Playlist Downloader With Python

Spotify Playlist Downloader This will let you download Spotify playlists for free without Premium. It gets all the songs from the API and downloads th

Yasho 16 Sep 28, 2022
ComicDownloader - Downloads Comics from readcomiconline.li

ComicDownloader Downloads Comics from readcomiconline.li To use this script from

2 Nov 08, 2022
This script fully automates of downloading tiktok videos, editing them,compiling them and finally uploading them to youtube.

This script fully automates of downloading tiktok videos, editing them,compiling them and finally uploading them to youtube. If you wanted to create a tiktok video compiilation youtubbe channel this

Supriyo Sarkar 32 Dec 16, 2022
YTPY Youtube Downloader Made by: Ferreira, Amarau and Rodric

YTPY Youtube Downloader Made by: Ferreira, Amarau and Rodric How to Install on Linux: sudo apt install python3 python3-pip git pip install pytube git

7 Nov 24, 2022
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.

46 Dec 09, 2022
A collection of modules I have created to programmatically search for/download imagery from live cam feeds across the state of California.

A collection of modules that I have created to programmatically search for/download imagery from all publicly available live cam feeds across the state of California. In no way am I affiliated with a

Chad Groom 5 Nov 21, 2022
code for paper"3D reconstruction method based on a generative model in continuous latent space"

PyTorch implementation of 3D-VGT(3D-VAE-GAN-Transformer) This repository contains the source code for the paper "3D reconstruction method based on a g

Tong 5 Apr 25, 2022
Downloads files and folders

PyDownloader Downloads files and folders at high speed (based on your interent speed). This is very useful to transfer big files from one computer to

ArmenG 4 Feb 24, 2022
A cross platform front-end GUI of the popular youtube-dl written in wxPython.

youtube-dlG A cross platform front-end GUI of the popular youtube-dl media downloader written in wxPython. Supported sites Screenshots Requirements Py

8.7k Dec 31, 2022
Search & download music from a certain streaming service

Search & download music from a certain streaming service

mat 2 Mar 11, 2022
A scriptable music downloader for Qobuz, Tidal, and Deezer

streamrip A scriptable stream downloader for Qobuz, Tidal, and Deezer. Features Downloads tracks, albums, playlists, discographies, and labels from Qo

967 Jan 03, 2023
Code to scrape , download and upload to youtube daily

Youtube_Automated_Channel Code to scrape , download and upload to youtube daily INSTRUCTIONS Download the Github Repository Download and install Pytho

Atsiksdong 2 Dec 19, 2021
Most versatile Telegram torrent and youtube-dl bot.

TorToolkit Telegram So basically Tortoolkit is aimed to be the most versatile torrent leecher and Youtube-DL bot for telegram. This bot is highly cust

Yash Khadse 541 Dec 22, 2022
This project is helps to download contents from Streamtape by utilizing the API

It scrapes Streamtape api and download contents from the site.

Debiprasad Das 5 Dec 28, 2022
Organize your downloads easily with DownloadOrganizer

DownloadOrganizer Organize your downloads organize your downloads easily with DownloadOrganizer Instilation how to install DownloadOrganizer Method 1:

1 Dec 02, 2021
Python module to donwload all Pixiv artworks of a user using it's user ID.

Python module to donwload all Pixiv artworks of a user using it's user ID. You need a PHPSESSID token to export NSFW.

Quatrecentquatre 1 Jan 27, 2022