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
Easy automated ebook downloader using openbooks as the backend

Easy automated ebook downloader using openbooks as the backend

27 Nov 06, 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
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
AI Dungeon Catalog Archive Toolkit

AI Dungeon Content Archive Toolkit (AID CAT) AID CAT is a command-line utility that will allow you to download JSON backups of: Your private and publi

Mimi 31 Oct 26, 2022
一个在新番更新后第一时间在dmhy等BT下载站自动下载的小工具.

Anime Track 一个在新番更新后第一时间自动下载的小工具. 可以根据自定义的关键字在dmhy等BT下载站在搜索结果更新时将磁力链发送至aria2实现自动下载. 基本功能包含: 将BT下载站的某个关键字的搜索结果的所有磁力链添加至ARIA2 自动更新aria2 trackers 将已添加的磁力

Sunky 24 Oct 12, 2022
Archivist - Easily archive 📦 Download folder to Google Drive ☁️

Archivist Script for archiving Download folder by uploading unmodified files to a Google Drive folder. Modified files will remain in the Download fold

Timing Liu 3 Sep 30, 2022
ASF Sentinel-1 Metadata Download tool

ASF Sentinel-1 Metadata Download tool Copyright: 2021-2022 Antonio Valentino Small Python tool (asfsmd) that allows to download XML files containing S

Antonio Valentino 9 Dec 04, 2022
A bot to download songs from YouTube to telegram.

Song-Downloader-Bot A BOT TO DOWNLOAD SONGS FROM YOUTUBE. Mandatory variables API_ID - Get It From my.telegram.org API_HASH - Get It From my.telegram.

Ashik Muhammed 38 Dec 11, 2022
Apple Music Animated Artwork Fetcher

A python script for downloading the animated artwork of an Apple Music album.

bunny 46 Jan 03, 2023
Application Updater using an download link

Application-Updater This tool will update your app using an storage link

ExtremeDev 1 Dec 20, 2021
Script for YouTube creators to share dislike count with their viewers.

Stahování disliků z YouTube - milafon Tento skript slouží jako možnost zobrazit divákům počet disliků u YouTube videí. Vyžaduje implementaci ze strany

4 Sep 28, 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
YT-Spammer-Purge - Allows you easily scan for and delete scam comments using several methods

YouTube Spammer Purge What Is This? - Allows you to filter and search for spamme

4.3k Dec 31, 2022
A simple GUI video downloader built off of the python module 'yt-dlp'

Simple-Youtube-DL-Gui Supported Operating Systems Windows 7 (x64), Windows 8 (x64), and Windows 10 (x64) How to use Main Gui Extract program from arch

12 Dec 30, 2022
Download Photo and Video from Wall of specific user or community

vkontakte-downloader Download Photo and Video from Wall of specific User or Community on https://vk.com Setup Clone the project git clone https://gith

4 Jul 20, 2022
A Simple YouTube Video Downloader With Python

Simple YouTube Video Downloader Simple YouTube Video Downloader is an open source project with a very simple UI that tries to speed up the process of

Brian Han 2 Jan 03, 2022
This is Yt Downloader. Coded with Python (my first repository)

Get Started Download & install Python first before using this software. Download Python Installing Python and Pytube Library (IMPORTANT) Installing Py

Qi 2 Oct 25, 2021
⚙️ A CLI tool that can download songs from youtube.

⚙️ Music Downloader Music Downloader is a tool that can download songs from Youtube. Installation Base requirements: Python 3.7+ If you have Python 3.

matjs 4 Nov 03, 2021
Storing, versioning, and downloading files from S3 made as easy as using open() in Python. Caching included.

open(LARGE) Storing, versioning, and downloading files from S3 made as easy as using open() in Python. Caching included. Motivation Oftentimes, especi

András Schmelczer 2 Jan 30, 2022
Terminal based YouTube player and downloader

termitube NOTE: THIS REPOSITORY IS A FORK OF mps-youtube as mps-youtube has been unmaintained for almost a year now. Features Search and play audio/vi

Otis/Jacob Root 27 Dec 23, 2022