Open GrechinStepan opened 1 year ago
hi, I need you to provide log information, or should you tell me how you use it :>
@staticmethod
def remove_captcha(page: Page) -> None:
captcha_checkbox = page.query_selector("input.CheckboxCaptcha-Button")
if captcha_checkbox:
captcha_checkbox.click()
page.wait_for_timeout(5000)
if 'Press in the following order' in page.content():
raise Exception('Captcha')
else:
page.wait_for_selector('li.serp-item_card', state='visible')
def parser(self, playwright: Playwright) -> None:
url = f"https://yandex.ru/search/?text={self.request}&lr={self.region_code}"
browser = playwright.chromium.launch(headless=False)
context = browser.new_context()
stealth_sync(context)
page = context.new_page()
page.route(re.compile(r"\.(jpg|png|svg)$"), lambda route: route.abort())
page.goto(url, wait_until='load', timeout=60_000)
self.remove_captcha(page)
self.get_all_adv_domains(page)
context.close()
browser.close()
On my PC this configuration works without any problems, proxy, user-agent and so on... But on Ubuntu i tried with all of this and still get captcha to solve
i tried rotating proxy, set viewport_size, set headless=False, different browser args, nothing helped
I don't understand what you mean "works" -O- It throws an error?
no errors, just "still get captcha to solve"
Hi, it works perfect on my Windows PC but doesn`t work on Ubuntu server at all.