Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Yelp帐户创建无法使用2captha Api解决Captha问题_Python_Api_Yelp - Fatal编程技术网

Python Yelp帐户创建无法使用2captha Api解决Captha问题

Python Yelp帐户创建无法使用2captha Api解决Captha问题,python,api,yelp,Python,Api,Yelp,嗨,我一直在使用2captha api python解决captha。。。。通过2captha api正确解决captha。。但一旦提交表单,它将显示另一个captha作为检测机器人。。 下面是发生的视频捕获: 这是我的密码 def创建账户(名字、姓氏、电子邮件、密码、保存文件=“yelp\u accounts.csv”): passport\u版本=错误 apikey=“” driver=webdriver.Chrome(“C:\Users\Admin\PycharmProjects\Yelp

嗨,我一直在使用2captha api python解决captha。。。。通过2captha api正确解决captha。。但一旦提交表单,它将显示另一个captha作为检测机器人。。 下面是发生的视频捕获:

这是我的密码

def创建账户(名字、姓氏、电子邮件、密码、保存文件=“yelp\u accounts.csv”): passport\u版本=错误 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)