Skip to content

Commit f94e751

Browse files
authored
Merge pull request #4 from KTS-o7/codeUpdate
Code update
2 parents 6c28876 + 45b00d0 commit f94e751

File tree

4 files changed

+79
-4
lines changed

4 files changed

+79
-4
lines changed

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Better Bing Image Downloader
22

3+
## Table of Contents
4+
5+
- [Disclaimer](#disclaimer)
6+
- [Installation](#installation)
7+
- [Usage](#usage)
8+
- [Requirements](#requirements)
9+
- [License](#license)
10+
- [Contact](#contact)
11+
312
### Disclaimer<br />
413

514
This program lets you download tons of images from Bing.
@@ -19,7 +28,7 @@ pip install .
1928

2029
or
2130

22-
```sh
31+
```bash
2332
pip install better-bing-image-downloader
2433
```
2534

@@ -34,7 +43,6 @@ from better_bing_image_downloader import download
3443
download.download(query_string, limit=100, output_dir='dataset', adult_filter_off=True, force_replace=False, timeout=60, verbose=True)
3544
```
3645

37-
`-h` : Gives a verbose help on what to do<br/>
3846
`query_string` : String to be searched.<br />
3947
`limit` : (optional, default is 100) Number of images to download.<br />
4048
`output_dir` : (optional, default is 'dataset') Name of output dir.<br />
@@ -44,3 +52,11 @@ download.download(query_string, limit=100, output_dir='dataset', adult_filter_o
4452
`filter` : (optional, default is "") filter, choose from [line, photo, clipart, gif, transparent]<br />
4553
`verbose` : (optional, default is True) Enable downloaded message.<br />
4654
`bad-sites` : (optional, defualt is empty list) Can limit the query to not access the bad sites.<br/>
55+
56+
### License
57+
58+
This project is licensed under the terms of the MIT license.
59+
60+
### Contact
61+
62+
If you have any questions or feedback, please contact us at [email](mailto:shentharkrishnatejaswi@gmail.com).

better_bing_image_downloader/bing.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,64 @@
1515

1616

1717
class Bing:
18+
"""_summary_
19+
A class to download images from Bing.
20+
21+
_description_
22+
This class is used to download images from Bing. It uses the Bing Image Search API to get the links of the images and then downloads the images from the links. The class can be used to download images based on a query, with a limit on the number of images to be downloaded. The images can be filtered based on the type of image (photo, clipart, line drawing, animated gif, transparent) and the adult content can be filtered as well. The images are saved in the specified output directory. The class also has the option to be verbose, which will print the progress of the download.
23+
24+
_parameters_
25+
26+
query : str
27+
The query to be used to search for images.
28+
limit : int
29+
The number of images to be downloaded.
30+
output_dir : str
31+
The directory where the images are to be saved.
32+
adult : str
33+
The adult content filter. Can be "off" or "on".
34+
timeout : int
35+
The time in seconds to wait for the request to Bing to be completed.
36+
filter : str
37+
The type of image to be filtered. Can be "line", "photo", "clipart", "gif", "transparent".
38+
verbose : bool
39+
Whether to print the progress of the download.
40+
41+
_methods_
42+
43+
get_filter(shorthand)
44+
Returns the filter string based on the shorthand.
45+
============
46+
shorthand : str
47+
The shorthand for the filter. Can be "line", "photo", "clipart", "gif", "transparent".
48+
============
49+
return : str
50+
The filter string based on the shorthand.
51+
52+
save_image(link, file_path)
53+
Saves the image from the link to the file path.
54+
============
55+
link : str
56+
The link of the image to be saved.
57+
file_path : str
58+
The file path where the image is to be saved.
59+
============
60+
return : None
61+
62+
download_image(link)
63+
Downloads the image from the link.
64+
============
65+
link : str
66+
The link of the image to be downloaded.
67+
============
68+
return : None
69+
70+
run()
71+
Runs the download of the images.
72+
============
73+
return : None
74+
75+
"""
1876
def __init__(self, query, limit, output_dir, adult, timeout, filter='', verbose=True,badsites=[]):
1977
self.download_count = 0
2078
self.query = query

better_bing_image_downloader/download.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ def download(query, limit=100, output_dir='dataset', adult_filter_off=True,
2222
force_replace (bool): Whether to replace existing files.
2323
timeout (int): The timeout for the image download.
2424
filter (str): The filter to apply to the search results.
25-
verbose (bool): Whether to print detailed output.
25+
verbose (bool): Whether to print detailed output._summary_
26+
badsites (list): List of bad sites to be excluded.
2627
"""
2728
# engine = 'bing'
2829
if adult_filter_off:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="better_bing_image_downloader",
8-
version="1.0.1",
8+
version="1.0.2",
99
author="Krishnatejaswi S",
1010
author_email="shentharkrishnatejaswi@gmail.com",
1111
description="This package is built on top of bing-image-downloader by gaurav singh",

0 commit comments

Comments
 (0)