Skip to content

Commit

Permalink
Update searches.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiwing authored Mar 14, 2024
1 parent 1d8cd9d commit c17db3d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/searches.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def bingSearches(self, numberOfSearches: int, pointsCounter: int = 0):
self.webdriver.get("https://bing.com")

i = 0
attempt = 0
for word in search_terms:
i += 1
logging.info(f"[BING] {i}/{numberOfSearches}")
Expand All @@ -76,6 +77,15 @@ def bingSearches(self, numberOfSearches: int, pointsCounter: int = 0):
pointsCounter = points
else:
break

if points <= pointsCounter:
attempt += 1
if attempt == 2:
logging.warning(
"[BING] Possible blockage. Refreshing the page."
)
self.webdriver.refresh()
attempt = 0
logging.info(
f"[BING] Finished {self.browser.browserType.capitalize()} Edge Bing searches !"
)
Expand Down

0 comments on commit c17db3d

Please sign in to comment.