如何在Python Selenium中使用2captcha API集成验证码旁路

pcrecxhr  于 2022-12-13  发布在  Python
关注(0)|答案(1)|浏览(141)

我正在做一个reddit账号自动生成器。我想问一下如何使用2captcha的API来绕过captcha。因为在输入用户名和密码后,新的captcha框会出现,我已经在2captcha页面,youtube上的视频教程中进行了研究,但仍然没有找到方法。谢谢大家,祝你们有美好的一天!

import pandas as pd
from selenium import webdriver
from selenium.webdriver.common.proxy import *
from selenium.webdriver.common.by import By
from time import sleep
import time
import openpyxl
import requests
import pandas as pd
from twocaptcha import TwoCaptcha

solver = TwoCaptcha('YOUR_API_KEY')

# Load the Excel file
...
# Loop through the rows of the DataFrame
...
   # Get the latest IP address from the proxy service
   ...
   # Update the capabilities object to use the new proxy
   ...
   # Create a new instance of the webdriver with the updated capabilities
   # Use selenium to signup with the username and password
   
   result = solver.recaptcha(sitekey='6LeTnxkTAAAAAN9QEuDZRpn90WwKk_R1TRW_g-JC',
   url='https://www.reddit.com/account/register/')
ars1skjm

ars1skjm1#

查看TwoCaptcha文档!

# Import the required libraries
from twocaptcha import TwoCaptcha

# Create a new TwoCaptcha solver object
solver = TwoCaptcha('YOUR_API_KEY')

# Solve the reCAPTCHA on the Reddit signup page
result = solver.recaptcha(sitekey='6LeTnxkTAAAAAN9QEuDZRpn90WwKk_R1TRW_g-JC',
                         url='https://www.reddit.com/account/register/')

# Check the result to see if the reCAPTCHA was successfully solved
if result['status'] == 0:
    # Success
else:
    # Error

相关问题