Skip to content

Commit

Permalink
Merge pull request #1 from steenstra/develop
Browse files Browse the repository at this point in the history
merge python < 3.10
  • Loading branch information
steenstra authored Nov 1, 2021
2 parents 905833d + 746795f commit fa6be32
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ downloader.download(query_string, limit=100, output_dir='dataset', adult_filter
`verbose` : (optional, default is True) Enable downloaded message.<br />



You can also test the programm by runnning `test.py keyword`


### PyPi <br />
Expand Down
17 changes: 6 additions & 11 deletions bing_image_downloader/bing.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,17 @@ def __init__(self, query, limit, output_dir, adult, timeout, filter='', verbose


def get_filter(self, shorthand):
match shorthand:
case ("line" | "linedrawing"):
if shorthand == "line" | shorthand == "linedrawing":
return "+filterui:photo-linedrawing"
case "photo":
elif shorthand == "photo":
return "+filterui:photo-photo"
case "clipart":
elif shorthand == "clipart":
return "+filterui:photo-clipart"
case ("gif" | "animatedgif"):
elif shorthand == "gif" | shorthand == "animatedgif":
return "+filterui:photo-animatedgif"
case "transparent":
elif shorthand == "transparent":
return "+filterui:photo-transparent"
case _:
else:
return ""


Expand Down Expand Up @@ -112,7 +111,3 @@ def run(self):

self.page_counter += 1
print("\n\n[%] Done. Downloaded {} images.".format(self.download_count))
print("===============================================\n")
print("Please show your support here")
print("https://www.buymeacoffee.com/gurugaurav")
print("\n===============================================\n")
22 changes: 22 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import sys
from bing_image_downloader import downloader

query=sys.argv[1]

if len(sys.argv) == 3:
filter=sys.argv[2]
else:
filter=""


downloader.download(
query,
limit=10,
output_dir="dataset",
adult_filter_off=True,
force_replace=False,
timeout=60,
filter=filter,
verbose=True,
)

0 comments on commit fa6be32

Please sign in to comment.