Привет, я застрял с решением Captha с использованием 2captha api python .... captha решена корректно с помощью 2captha api .. но после отправки формы будет показана другая капта как обнаружение бота .. вот захват видео, что случилось : https://youtu.be/7MEhJlTtvFI
вот мой код
def create_account (имя, фамилия, адрес электронной почты, пароль, save_file = "yelp_accounts.csv"): passport_version = False apikey = "" driver = webdriver. Chrome ("C: \ Users \ Admin \ PycharmProjects \ YelpBot \ drivers \ chromedriver.exe")
driver.get("https://www.yelp.com/signup")
first_name = firstname
last_name = lastname
driver.find_element_by_id("first_name").send_keys(first_name)
driver.find_element_by_id("last_name").send_keys(last_name)
mail=email
driver.find_element_by_id("email").send_keys(mail)
pwd = password
driver.find_element_by_id("password").send_keys(pwd)
zip="84480"
driver.find_element_by_id("zip").send_keys(zip)
driver.find_element_by_id("signup-button").click()
sleep(5)
googlekey="6Le5OSYTAAAAADy8seTrWT0eqpS795iV32Gm9Ag1"
# Add these values
API_KEY = apikey # Your 2captcha API KEY
site_key = googlekey # site-key, read the 2captcha docs on how to get this
url=WebDriverWait(driver, 10).until(ec.presence_of_element_located((By.XPATH, "/html/body/div[2]/div[2]/div/div[3]/div[1]/div/div/div[1]/div[1]/form/div[3]/div/div/div/iframe"))).get_attribute("src")
print url
s = requests.Session()
# here we post site key to 2captcha to get captcha ID (and we parse it here too)
captcha_id = s.post("http://2captcha.com/in.php?key={}&method=userrecaptcha&googlekey={}&pageurl={}".format(
API_KEY, site_key, url)).text.split('|')[1]
# then we parse gresponse from 2captcha response
recaptcha_answer = s.get(
"http://2captcha.com/res.php?key={}&action=get&id={}".format(API_KEY, captcha_id)).text
print("solving ref captcha...")
while 'CAPCHA_NOT_READY' in recaptcha_answer:
sleep(5)
recaptcha_answer = s.get(
"http://2captcha.com/res.php?key={}&action=get&id={}".format(API_KEY, captcha_id)).text
recaptcha_answer = recaptcha_answer.split('|')[1]
print recaptcha_answer
driver.execute_script(
"arguments[0].style.display='inline'",
driver.find_element_by_xpath(
'//*[@id="g-recaptcha-response"]'
),
)
driver.execute_script(
'document.getElementById("g-recaptcha-response").innerHTML = "%s"'
% recaptcha_answer
)
#sleep(5)
driver.find_element_by_id('signup-button').click()
sleep(20)