如何使用python解决2captcha.com中的正常repatcha



我正试图解决https://2captcha.com/demo/normal在我的项目中实现python代码之前先使用它。但是,我有点困惑,我应该如何发送我的图像captcha。

以下是我应该如何提交表格以获得问题id:的代码

<form method="post" action="https://2captcha.com/in.php" enctype="multipart/form-data">
<input type="hidden" name="method" value="post" />
Your key:
<input type="text" name="key" value="YOUR_APIKEY" />
The CAPTCHA file:
<input type="file" name="file" />
<input type="submit" value="Upload and get the ID" />

这是我想解决的图像URL:

https://2captcha.com/dist/web/99581b9d446a509a0a01954438a5e36a.jpg

我打算使用Python代码向2captcha.com(使用请求库(发出一个post请求,以获得问题id,比如这个

OK|2122988149

我真的很感激任何能提供帮助的人。

这适用于链接中给出的示例:

from twocaptcha import TwoCaptcha
solver = TwoCaptcha('your_key')
ele = driver.find_elements(By.XPATH, "//img[contains(@alt,'captcha example')]")[0]
result = solver.normal(file=ele.get_attribute('src'))
print(result)

最新更新