Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠

Preserve Yidun and reCAPTCHA endpoints in fallback

Emre Sokullub7b47076dde6
diff --git a/src/chrome/src/agent/captcha-native-providers.js b/src/chrome/src/agent/captcha-native-providers.js
index e1f5acc33..38d7a2e96 100644
--- a/src/chrome/src/agent/captcha-native-providers.js
+++ b/src/chrome/src/agent/captcha-native-providers.js
@@ -173,17 +173,17 @@ const FAMILY_IDENTIFIERS = {
['incapsulaCookies', 'metadata.incapsulaCookies'], ['reese84UrlEndpoint', 'metadata.reese84UrlEndpoint']],
tspd: [['tspdCookie', 'metadata.tspdCookie'], ['htmlPageBase64', 'metadata.htmlPageBase64']],
binance: [['validateId']],
- yidun: [['challenge'], ['hcg'], ['hct']],
+ yidun: [['challenge'], ['hcg'], ['hct'], ['yidunApiServerSubdomain'], ['yidunGetLib']],
hcaptcha: [['rqdata', 'data.rqdata']],
funcaptcha: [['data']],
text_captcha: [['comment', 'textcaptcha']],
captchafox: [['apiServer', 'api_server']],
altcha: [['challengeURL', 'challenge_url'], ['challengeJSON', 'challenge_json']],
friendly: [['version'], ['moduleScript', 'module_script'], ['nomoduleScript', 'nomodule_script']],
- recaptcha_v2: [['recaptchaDataSValue', 'enterprisePayload.s', 'data-s', 'data.s']],
- recaptcha_v2_enterprise: [['recaptchaDataSValue', 'enterprisePayload.s', 'data-s', 'data.s']],
- recaptcha_v3: [['pageAction', 'action', 'data.action'], ['minScore', 'min_score']],
- recaptcha_v3_enterprise: [['pageAction', 'action', 'data.action'], ['minScore', 'min_score']],
+ recaptcha_v2: [['recaptchaDataSValue', 'enterprisePayload.s', 'data-s', 'data.s'], ['apiDomain', 'domain']],
+ recaptcha_v2_enterprise: [['recaptchaDataSValue', 'enterprisePayload.s', 'data-s', 'data.s'], ['apiDomain', 'domain']],
+ recaptcha_v3: [['pageAction', 'action', 'data.action'], ['minScore', 'min_score'], ['apiDomain', 'domain']],
+ recaptcha_v3_enterprise: [['pageAction', 'action', 'data.action'], ['minScore', 'min_score'], ['apiDomain', 'domain']],
turnstile: [
['action', 'pageAction', 'metadata.action', 'data.action'],
['data', 'cData', 'metadata.cdata', 'data.cdata', 'data.cData'],
diff --git a/src/firefox/src/agent/captcha-native-providers.js b/src/firefox/src/agent/captcha-native-providers.js
index e1f5acc33..38d7a2e96 100644
--- a/src/firefox/src/agent/captcha-native-providers.js
+++ b/src/firefox/src/agent/captcha-native-providers.js
@@ -173,17 +173,17 @@ const FAMILY_IDENTIFIERS = {
['incapsulaCookies', 'metadata.incapsulaCookies'], ['reese84UrlEndpoint', 'metadata.reese84UrlEndpoint']],
tspd: [['tspdCookie', 'metadata.tspdCookie'], ['htmlPageBase64', 'metadata.htmlPageBase64']],
binance: [['validateId']],
- yidun: [['challenge'], ['hcg'], ['hct']],
+ yidun: [['challenge'], ['hcg'], ['hct'], ['yidunApiServerSubdomain'], ['yidunGetLib']],
hcaptcha: [['rqdata', 'data.rqdata']],
funcaptcha: [['data']],
text_captcha: [['comment', 'textcaptcha']],
captchafox: [['apiServer', 'api_server']],
altcha: [['challengeURL', 'challenge_url'], ['challengeJSON', 'challenge_json']],
friendly: [['version'], ['moduleScript', 'module_script'], ['nomoduleScript', 'nomodule_script']],
- recaptcha_v2: [['recaptchaDataSValue', 'enterprisePayload.s', 'data-s', 'data.s']],
- recaptcha_v2_enterprise: [['recaptchaDataSValue', 'enterprisePayload.s', 'data-s', 'data.s']],
- recaptcha_v3: [['pageAction', 'action', 'data.action'], ['minScore', 'min_score']],
- recaptcha_v3_enterprise: [['pageAction', 'action', 'data.action'], ['minScore', 'min_score']],
+ recaptcha_v2: [['recaptchaDataSValue', 'enterprisePayload.s', 'data-s', 'data.s'], ['apiDomain', 'domain']],
+ recaptcha_v2_enterprise: [['recaptchaDataSValue', 'enterprisePayload.s', 'data-s', 'data.s'], ['apiDomain', 'domain']],
+ recaptcha_v3: [['pageAction', 'action', 'data.action'], ['minScore', 'min_score'], ['apiDomain', 'domain']],
+ recaptcha_v3_enterprise: [['pageAction', 'action', 'data.action'], ['minScore', 'min_score'], ['apiDomain', 'domain']],
turnstile: [
['action', 'pageAction', 'metadata.action', 'data.action'],
['data', 'cData', 'metadata.cdata', 'data.cdata', 'data.cData'],
diff --git a/test/captcha-native-providers.mjs b/test/captcha-native-providers.mjs
index 14c9c3afe..38d2ab8bd 100644
--- a/test/captcha-native-providers.mjs
+++ b/test/captcha-native-providers.mjs
@@ -429,7 +429,9 @@ for (const browser of ['chrome', 'firefox']) {
['reCAPTCHA v2 data-s', ['2captcha', 'RecaptchaV2TaskProxyless', { websiteURL: url, websiteKey: 'site', recaptchaDataSValue: 'observed' }], ['solvecaptcha', 'recaptcha_v2', { pageurl: url, googlekey: 'site', 'data-s': 'observed' }], 'data-s'],
['reCAPTCHA v2 enterprise data-s', ['2captcha', 'RecaptchaV2EnterpriseTaskProxyless', { websiteURL: url, websiteKey: 'site', enterprisePayload: { s: 'observed' } }], ['solvecaptcha', 'recaptcha_v2_enterprise', { pageurl: url, googlekey: 'site', 'data-s': 'observed' }], 'data-s'],
['reCAPTCHA v2 nested data-s', ['2captcha', 'RecaptchaV2TaskProxyless', { websiteURL: url, websiteKey: 'site', recaptchaDataSValue: 'observed' }], ['nopecha', 'token/recaptcha2', { url, sitekey: 'site', data: { s: 'observed' } }], 'data.s'],
+ ['reCAPTCHA v2 API domain alias', ['2captcha', 'RecaptchaV2TaskProxyless', { websiteURL: url, websiteKey: 'site', apiDomain: 'recaptcha.net' }], ['solvecaptcha', 'recaptcha_v2', { pageurl: url, googlekey: 'site', domain: 'recaptcha.net' }], 'domain'],
['reCAPTCHA v3 action', ['2captcha', 'RecaptchaV3TaskProxyless', { websiteURL: url, websiteKey: 'site', minScore: 0.3, pageAction: 'login' }], ['solvecaptcha', 'recaptcha_v3', { pageurl: url, googlekey: 'site', action: 'login', min_score: 0.3 }], 'action'],
+ ['reCAPTCHA v3 API domain', ['2captcha', 'RecaptchaV3TaskProxyless', { websiteURL: url, websiteKey: 'site', minScore: 0.3, apiDomain: 'recaptcha.net' }], ['anti-captcha', 'RecaptchaV3TaskProxyless', { websiteURL: url, websiteKey: 'site', minScore: 0.3, apiDomain: 'recaptcha.net' }], 'apiDomain'],
['reCAPTCHA v3 score', ['2captcha', 'RecaptchaV3TaskProxyless', { websiteURL: url, websiteKey: 'site', minScore: 0.9, pageAction: 'login' }], ['solvecaptcha', 'recaptcha_v3', { pageurl: url, googlekey: 'site', action: 'login', min_score: 0.9 }], 'min_score'],
['reCAPTCHA v3 enterprise score', ['2captcha', 'RecaptchaV3TaskProxyless:enterprise', { websiteURL: url, websiteKey: 'site', minScore: 0.9, pageAction: 'login' }], ['solvecaptcha', 'recaptcha_v3:enterprise', { pageurl: url, googlekey: 'site', action: 'login', min_score: 0.9 }], 'min_score'],
['TSPD page snapshot', ['2captcha', 'TspdTask', { websiteURL: url, tspdCookie: 'cookie', htmlPageBase64: 'PAGE-A', proxyType: 'http', proxyAddress: 'proxy.test', proxyPort: 8080, userAgent: 'browser-UA' }], ['capmonster', 'CustomTask:tspd', { websiteURL: url, metadata: { tspdCookie: 'cookie', htmlPageBase64: 'PAGE-A' }, proxyType: 'http', proxyAddress: 'proxy.test', proxyPort: 8080, userAgent: 'browser-UA' }], 'metadata.htmlPageBase64'],
@@ -438,6 +440,8 @@ for (const browser of ['chrome', 'firefox']) {
['Turnstile cData', ['2captcha', 'TurnstileTaskProxyless', { websiteURL: url, websiteKey: 'site', action: 'login', data: 'widget' }], ['anti-captcha', 'TurnstileTaskProxyless', { websiteURL: url, websiteKey: 'site', action: 'login', cData: 'widget' }], 'cData'],
['Turnstile page data', ['2captcha', 'TurnstileTaskProxyless', { websiteURL: url, websiteKey: 'site', pagedata: 'page' }], ['solvecaptcha', 'turnstile', { pageurl: url, sitekey: 'site', pagedata: 'page' }], 'pagedata'],
['Turnstile nested metadata', ['capmonster', 'TurnstileTask', { websiteURL: url, websiteKey: 'site', pageAction: 'login', data: 'widget' }], ['nopecha', 'token/turnstile', { url, sitekey: 'site', proxy: { scheme: 'http', host: 'proxy.test', port: 8080 }, data: { action: 'login', cdata: 'widget' } }], 'data.cdata'],
+ ['Yidun API host', ['2captcha', 'YidunTaskProxyless', { websiteURL: url, websiteKey: 'site', challenge: 'challenge', yidunApiServerSubdomain: 'c.dun.163.com' }], ['capmonster', 'YidunTask', { websiteURL: url, websiteKey: 'site', challenge: 'challenge', yidunApiServerSubdomain: 'c.dun.163.com' }], 'yidunApiServerSubdomain'],
+ ['Yidun library', ['2captcha', 'YidunTaskProxyless', { websiteURL: url, websiteKey: 'site', challenge: 'challenge', yidunGetLib: 'https://c.dun.163.com/lib.js' }], ['capmonster', 'YidunTask', { websiteURL: url, websiteKey: 'site', challenge: 'challenge', yidunGetLib: 'https://c.dun.163.com/lib.js' }], 'yidunGetLib'],
];
for (const [label, a, b, changed] of actionBoundPairs) test(`${browser}: ${label} mismatch cannot spend`, async t => {
const calls = mockApi(t, () => { throw new Error('Must not dispatch'); });