diff --git a/app/utils/nvMapPwScraper.py b/app/utils/nvMapPwScraper.py index f54f380..0293d12 100644 --- a/app/utils/nvMapPwScraper.py +++ b/app/utils/nvMapPwScraper.py @@ -15,7 +15,7 @@ class NvMapPwScraper(): _context = None _win_width = 1280 _win_height = 720 - _max_retry = 60 # place id timeout threshold seconds + _max_retry = 40 # place id timeout threshold seconds # instance var page = None @@ -105,7 +105,10 @@ patchedGetter.toString();''') wait_first_start = time.perf_counter() - await self.goto_url(url, wait_until="networkidle",timeout = self._max_retry/2*1000) + try: + await self.goto_url(url, wait_until="networkidle",timeout = self._max_retry/2*1000) + except: + await self.page.reload(wait_until="networkidle", timeout = self._max_retry/2*1000) wait_first_time = (time.perf_counter() - wait_first_start) * 1000 @@ -114,15 +117,17 @@ patchedGetter.toString();''') if "/place/" in self.page.url: return self.page.url - logger.debug(f"[DEBUG] Try {count+1} : url place id not found, retry for forced collect answer") + logger.debug(f"[DEBUG] Try {count+1} : url place id not found, retry for forced collect answer") wait_forced_correct_start = time.perf_counter() url = self.page.url.replace("?","?isCorrectAnswer=true&") - await self.goto_url(url, wait_until="networkidle",timeout = self._max_retry/2*1000) + try: + await self.goto_url(url, wait_until="networkidle",timeout = self._max_retry/2*1000) + except: + await self.page.reload(wait_until="networkidle", timeout = self._max_retry/2*1000) wait_forced_correct_time = (time.perf_counter() - wait_forced_correct_start) * 1000 - logger.debug(f"[DEBUG] Try {count+1} : Wait for forced isCorrectAnswer flag : {wait_forced_correct_time}ms") if "/place/" in self.page.url: