标签: 2captcha

使用带有g-recaptcha-response参数的POST提交表单

我想从以下网页提交表格:http://www.hzzo-net.hr/statos_OIB.htm

首先,我使用2captcha服务绕过recaptcha:

# parameters
api_key <- "c+++"
api_url <- "http://2captcha.com/in.php"
site_key <- "6Lc3SAgUAAAAALFnYxUbXlcJ8I9grvAPC6LFTKQs"
hzzo_url <- "http://www.hzzo-net.hr/statos_OIB.htm"

# GET method
req_url <- paste0("http://2captcha.com/in.php?key=", api_key,"&method=userrecaptcha&googlekey=", 
                  site_key, "&pageurl=", hzzo_url)
get_response <- POST(req_url)
hzzo_content <- content(get_response)
hzzo_content <- xml_text(hzzo_content)
captcha_id <- stringr::str_extract_all(hzzo_content[[1]], "\\d+")[[1]]

# solve captcha
Sys.sleep(16L)
captcha2_solve <- function(apiKey, capstchaID){
  req_url <- paste0("http://2captcha.com/res.php?key=", api_key,"&action=get&id=", capstchaID)
  result <- GET(req_url)
  captcha_content <- content(result)
  hzzo_response <- xml_text(captcha_content)
  hzzo_response <- strsplit(hzzo_response, "\\|")
  return(hzzo_response)
  # hzzo_response <- hzzo_response[[1]][[2]]
  # return(hzzo_response)
}
hzzo_response <- captcha2_solve(api_key, captcha_id) …
Run Code Online (Sandbox Code Playgroud)

python r recaptcha httr 2captcha

8
推荐指数
1
解决办法
1272
查看次数

将 2captcha 与 Python 结合使用

我对 2captchas 和 Python 完全陌生,所以我试图弄清楚这两者是如何工作的。现在我正在编写一个Python脚本并在spyder上运行它来解析图像验证码。我的代码(使用 2captcha API)返回网站的 html 作为返回响应。它尝试注册一个站点,但作为回报,解析验证码的主要任务失败了。我的代码看起来像这样

import requests
from time import sleep

API_KEY = '2captchaapi'  # Your 2captcha API KEY
site_key = '2captcha site key'  # site-key, read the 2captcha docs on how to get this
url = 'site'  # example url
proxy = 'proxy'  # example proxy

proxy = {'http': 'http://' + proxy, 'https': 'https://' + proxy}

s = requests.Session()


# here we post site key to 2captcha to get captcha ID (and we parse it …
Run Code Online (Sandbox Code Playgroud)

python captcha 2captcha

8
推荐指数
1
解决办法
7104
查看次数

如何识别 ReCaptcha V2 的 32 位数据站点密钥,以使用 Selenium 和 Python 请求以编程方式获取有效响应?

验证码和 Python 请求几乎是新的。验证码文档说要复制参数的值data-sitekey

这是我的尝试,使用Selenium打开 url 并使用 Pythonrequests获取响应。

mainurl = 'https://imagetyperz.xyz/automation/recaptcha-v2.html'
driver.get(mainurl)
data_sitekey_class = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CLASS_NAME, "g-recaptcha"))).get_attribute("data-sitekey")
print(data_sitekey_class)
src_css_selector = driver.find_element_by_css_selector("iframe[role='presentation']").get_attribute("src")
print(src_css_selector)
keygoogle = src_css_selector[52:92]
print('Site Key = ', keygoogle)
data_post = {'key': data_sitekey_class, 'method': 'userrecaptcha', 'googlekey': keygoogle, "pageurl": mainurl}
response = requests.post(url = 'https://2captcha.com/in.php', data = data_post )
print(response)
print(response.text)
Run Code Online (Sandbox Code Playgroud)

我得到的200答复是:

6LdXeIYUAAAAAFmFKJ6Cl3zo4epRZ0LDdOrYsvRY
https://www.google.com/recaptcha/api2/anchor?ar=1&k=6LdXeIYUAAAAAFmFKJ6Cl3zo4epRZ0LDdOrYsvRY&co=aHR0cHM6Ly9pbWFnZXR5cGVyei54eXo6NDQz&hl=en&v=vJuUWXolyYJx1oqUVmpPuryQ&size=normal&cb=r14cgu7t25ul
Site Key =  6LdXeIYUAAAAAFmFKJ6Cl3zo4epRZ0LDdOrYsvRY
<Response [200]>
ERROR_WRONG_USER_KEY
Run Code Online (Sandbox Code Playgroud)

这是由于:

ERROR_WRONG_USER_KEY
Run Code Online (Sandbox Code Playgroud)

此外,错误部分提到:

Error code: ERROR_WRONG_USER_KEY
Description: You've …
Run Code Online (Sandbox Code Playgroud)

python selenium recaptcha python-requests 2captcha

5
推荐指数
1
解决办法
7061
查看次数

Selenium 使用 2captcha Python 提交 recaptcha

我正在尝试使用 Python3、Selenium 和 2captcha 在搜索表单上提交 Recaptcha。除了在 Recaptcha 的文本区域中发送 google-tokin 后提交 Recaptcha 之外,一切正常。请指导我我错过了什么?当我查看 Selenium Webdriver 窗口时,它显示了包含 google-tokin 的 Recaptcha 文本区域,但我无法提交它以继续搜索结果。谢谢。

from selenium import webdriver
from time import sleep
from datetime import datetime
from twocaptcha import TwoCaptcha
import requests

## Launching webdriver
driverop = webdriver.ChromeOptions()
driverop.add_argument("--start-maximized")
driver = webdriver.Chrome("chromedriver/chromedriver",options=driverop)
url = "https://app.skipgenie.com/Account/Login"
sleep(randint(5,10))
email = "..."
password = ".."

input_data = pd.read_excel("input_data.xlsx")
user_Data = []
driver.get(url)
driver.find_element_by_id("Email").send_keys(email)
driver.find_element_by_id("Password").send_keys(password)
driver.find_element_by_class_name("btn-lg").click()

driver.find_element_by_id("firstName").send_keys(input_data.iloc[0][0])
driver.find_element_by_id("lastName").send_keys(input_data.iloc[0][1])
driver.find_element_by_id("street").send_keys(input_data.iloc[0][2])
driver.find_element_by_id("city").send_keys(input_data.iloc[0][3])
driver.find_element_by_id("state").send_keys(input_data.iloc[0][4])
driver.find_element_by_id("zip").send_keys(int(input_data.iloc[0][5]))

# 2Captcha service
service_key = 'ec.....' # …
Run Code Online (Sandbox Code Playgroud)

selenium recaptcha python-3.x selenium-webdriver 2captcha

2
推荐指数
1
解决办法
3475
查看次数

2captcha API + 硒

所以我正在使用这个 2captcha API 并在 omegle.com 之类的网站上对其进行测试。验证码解决发生了,但谷歌验证码框没有被勾选,什么也没有发生。想知道为什么会这样,我知道 2captcha API 运行得很好……但它只适用于 HTTP 请求而不适用于 selenium?

这是我插入到下面代码中的 API 链接:https : //github.com/2captcha/2captcha-api-examples/blob/master/ReCaptcha%20v2%20API%20Examples/Python%20Example/2captcha_python_api_example.py

from selenium import webdriver
from time import sleep
from selenium.common.exceptions import InvalidElementStateException
from selenium.common.exceptions import UnexpectedAlertPresentException
import time,os
import requests

fp = webdriver.FirefoxProfile('C:\\Users\\mo\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\b0wnbtro.dev-edition-default')
interest = input("Enter the interests seperate by a comma ")
msg1 = "1"
msg2 ="2"
msg3 = "3"
msg4 = "4"
driver = webdriver.Firefox(fp)

#2CAPTCHA API CODE INSERTED HERE FOR A TEST RUN BEFORE BEING INCORPORATED IN A LOOP …
Run Code Online (Sandbox Code Playgroud)

python selenium 2captcha

1
推荐指数
1
解决办法
4431
查看次数

2captcha 和 apify 之类的验证码解决服务如何在内部使用 data-sitekey 复制我的验证码?

据我从各种博客了解到,像 2captcha 这样的网站是一种人工图像和验证码识别服务。它的主要目的是由始终在线接收我的验证码的员工快速准确地解决您的验证码,并最终解决相同的问题。

现在让我们以https://www.google.com/recaptcha/api2/demo为例。假设生成了一个验证码,2个验证码就像data-sitekey为每个验证码生成的服务需求。

data-sitekey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-"
Run Code Online (Sandbox Code Playgroud)

现在我不明白的是,验证码解算器如何仅使用数据站点密钥在其端复制/重现验证码。谷歌是否提供任何服务来复制相同的内容?

另一端的人如何接收自己这边的相同验证码、解决它并将其发回?

captcha recaptcha web-scraping apify 2captcha

1
推荐指数
1
解决办法
1354
查看次数

如何以编程方式将验证码图像上传到python中的解决方案服务(给出html)?

我正在编写一个python程序,需要能够在网站上解决验证码.我想用2captcha.我已经使用selenium编写了一个python脚本,它将完成我需要做的所有事情,除了解决验证码.当我点击2captcha.com"API"标签时,这(以及其他参数)显示的是:

您可以以两种可用格式上传您的CAPTCHA:

Multipart和Base64:

Multipad样本:

<form method="post" action="http://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="download and get the ID">
</form>
Run Code Online (Sandbox Code Playgroud)

YOUR_APIKEY - 是32个符号长度的密钥.

Base64示例:

<form method="post" action="http://2captcha.com/in.php">
<input type="hidden" name="method" value="base64">
Your key:
<input type="text" name="key" value="YOUR_APIKEY">
The CAPTCHA file body in base64 format:
<textarea name="body">BASE64_FILE</textarea>
<input type="submit" value="download and get the ID">
</form>
Run Code Online (Sandbox Code Playgroud)

YOUR_APIKEY - 是32个符号长度的密钥.

BASE64_FILE - 是基于64位编码的图像体.

我知道python,它的大部分科学和数学模块都很好,但我对网络相关的编程有点新意.上面的代码看起来像html.我如何让python程序执行上面的html指令?

html python selenium selenium-webdriver 2captcha

0
推荐指数
1
解决办法
4958
查看次数