Skip to content

Commit

Permalink
Merge pull request ultralytics#12 from NicolasGrosjean/patch-7
Browse files Browse the repository at this point in the history
Fix exact_size parameter
  • Loading branch information
Joeclinton1 authored Mar 3, 2022
2 parents c773e1c + 36e5c06 commit ce512d9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions google_images_download/google_images_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,11 +501,6 @@ def build_url_parameters(self, arguments):
else:
lang_url = ''

if arguments['exact_size']:
size_array = [x.strip() for x in arguments['exact_size'].split(',')]
exact_size = ",isz:ex,iszw:" + str(size_array[0]) + ",iszh:" + str(size_array[1])
else:
exact_size = ''

built_url = "&tbs="
counter = 0
Expand Down Expand Up @@ -548,7 +543,7 @@ def build_url_parameters(self, arguments):
else:
built_url = built_url + ',' + ext_param
counter += 1
built_url = lang_url + built_url + exact_size
built_url = lang_url + built_url
return built_url

# building main search URL
Expand Down Expand Up @@ -1047,6 +1042,11 @@ def download_executor(self, arguments):
d = json.loads(json_acceptable_string)
time_range = ' after:' + d['time_min'] + ' before:' + d['time_max']

exact_size = ''
if arguments['exact_size']:
size_array = [x.strip() for x in arguments['exact_size'].split(',')]
exact_size = " imagesize:" + str(size_array[0]) + "x" + str(size_array[1])

######Initialization Complete
total_errors = 0
for pky in prefix_keywords: # 1.for every prefix keywords
Expand Down Expand Up @@ -1076,7 +1076,7 @@ def download_executor(self, arguments):

params = self.build_url_parameters(arguments) # building URL with params

search_term += time_range
search_term += time_range + exact_size
url = self.build_search_url(search_term, params, arguments['url'], arguments['similar_images'],
arguments['specific_site'],
arguments['safe_search']) # building main search url
Expand Down

0 comments on commit ce512d9

Please sign in to comment.