Fixed data lose after captcha. Maybe...
This commit is contained in:
parent
19821b22d6
commit
71825351c8
|
@ -70,8 +70,11 @@ class StolichkiDriver(uc.Chrome):
|
|||
resp_url = message["params"]["response"]["url"]
|
||||
|
||||
if re.fullmatch(url_re, resp_url):
|
||||
body_ = self.execute_cdp_cmd("Network.getResponseBody", {"requestId": request_id})
|
||||
body = json.loads(body_['body'])
|
||||
try:
|
||||
body_ = self.execute_cdp_cmd("Network.getResponseBody", {"requestId": request_id})
|
||||
body = json.loads(body_['body'])
|
||||
except:
|
||||
continue
|
||||
|
||||
return body
|
||||
|
||||
|
@ -110,7 +113,7 @@ class StolichkiDriver(uc.Chrome):
|
|||
if self.wait_for_presence():
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
continue
|
||||
|
||||
continue
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import re
|
||||
import time
|
||||
|
||||
from loguru import logger
|
||||
from selenium.webdriver.common.by import By
|
||||
|
@ -110,15 +109,13 @@ class ByfarmCategoryParser(BaseCategoryParser):
|
|||
if (product_info and product_farms) and (product_farms.get("status") == product_info.get("status")):
|
||||
return Product(product_info["drug"], product_farms["stores"])
|
||||
|
||||
self.driver.refresh()
|
||||
|
||||
return None
|
||||
|
||||
def farms_loading_handler(self):
|
||||
try:
|
||||
ActionChains(self.driver).scroll_by_amount(0, 1300).scroll_by_amount(0, -100).perform()
|
||||
|
||||
return self.driver.wait_for_presence(by=By.CLASS_NAME, value="tr-start-store", delay=60)
|
||||
return self.driver.wait_for_presence(by=By.CLASS_NAME, value="tr-start-store")
|
||||
|
||||
except:
|
||||
if not self.driver.handle_captcha():
|
||||
|
|
Loading…
Reference in New Issue