Skip to content

Commit 0d7d637

Browse files
committed
Follow the Google API limit
1 parent 39dc181 commit 0d7d637

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tools/msu_finder.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,15 @@ def find_msb_numbers(keyword)
418418
msb_numbers << msb.downcase
419419
end
420420
end
421+
421422
next_starting_index = get_next_index(results)
422-
break if next_starting_index == 0
423+
next_page = results['queries']['nextPage']
424+
425+
# Google API Documentation:
426+
# https://developers.google.com/custom-search/json-api/v1/using_rest
427+
# "This role is not present if the current results are the last page.
428+
# Note: This API returns up to the first 100 results only."
429+
break if next_page.nil? || next_starting_index > 100
423430
end
424431
rescue RuntimeError => e
425432
print_error(e.message)

0 commit comments

Comments
 (0)