Just noticed that a Proxy Recaptcha task fails, with the following error from AntiCaptcha
ID: 24 | CODE: ERROR_INCORRECT_SESSION_DATA | Some of the required values for successive user emulation are missing. Missing property 'proxyAddress'
Had a look, it's because the params request has the details nested at the root level of the JSON payload, whereas if you look at the specs it should be nested in the task
element.
https://anticaptcha.atlassian.net/wiki/spaces/API/pages/5079089/NoCaptchaTask+Google+Recaptcha+puzzle+solving
WHAT IT GENERATES
{
"clientKey": "dce6bcbb1a728ea8d871de6d169a2057",
"task": {
"type": "NoCaptchaTask",
"websiteURL": "http://mywebsite.com/recaptcha/test.php",
"websiteKey": "6Lc_aCMTAAAAABx7u2N0D1XnVbI_v6ZdbM6rYf16",
},
"proxyType": "http",
"proxyAddress": "8.8.8.8",
"proxyPort": 8080,
"proxyLogin": "proxyLoginHere",
"proxyPassword": "proxyPasswordHere",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36"
}
WHAT IT SHOULD GENERATE
{
"clientKey":"dce6bcbb1a728ea8d871de6d169a2057",
"task":
{
"type":"NoCaptchaTask",
"websiteURL":"http://mywebsite.com/recaptcha/test.php",
"websiteKey":"6Lc_aCMTAAAAABx7u2N0D1XnVbI_v6ZdbM6rYf16",
"proxyType":"http",
"proxyAddress":"8.8.8.8",
"proxyPort":8080,
"proxyLogin":"proxyLoginHere",
"proxyPassword":"proxyPasswordHere",
"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36"
}
}
Tested the simple fix, which is in the Client.
lib/anti_captcha/client.rb
if PROXYABLE_TASKS.include?(type)
if proxy.nil?
args[:task][:type] += 'Proxyless'
else
args.merge!(
proxyType: proxy[:proxy_type],
proxyAddress: proxy[:proxy_address],
proxyPort: proxy[:proxy_port],
proxyLogin: proxy[:proxy_login],
proxyPassword: proxy[:proxy_password],
userAgent: proxy[:user_agent],
)
end
end
BECOMES
if PROXYABLE_TASKS.include?(type)
if proxy.nil?
args[:task][:type] += 'Proxyless'
else
args[:task].merge!(
proxyType: proxy[:proxy_type],
proxyAddress: proxy[:proxy_address],
proxyPort: proxy[:proxy_port],
proxyLogin: proxy[:proxy_login],
proxyPassword: proxy[:proxy_password],
userAgent: proxy[:user_agent],
)
end
end