Skip to content

Commit

Permalink
Merge pull request #20 from sid7631/master
Browse files Browse the repository at this point in the history
fix duplicate images
  • Loading branch information
gurugaurav authored Jan 28, 2022
2 parents 13b46d5 + 6b3b686 commit 0bdeab6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bing_image_downloader/bing.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def __init__(self, query, limit, output_dir, adult, timeout, filters='', verbos
self.adult = adult
self.filters = filters
self.verbose = verbose
self.seen = set()

assert type(limit) == int, "limit must be integer"
self.limit = limit
Expand Down Expand Up @@ -90,7 +91,8 @@ def run(self):
print("\n===============================================\n")

for link in links:
if self.download_count < self.limit:
if self.download_count < self.limit and link not in self.seen:
self.seen.add(link)
self.download_image(link)

self.page_counter += 1
Expand Down

0 comments on commit 0bdeab6

Please sign in to comment.