@@ -282,6 +282,15 @@ export interface paramsTencent {
282282 proxytype ?: string
283283}
284284
285+ export interface paramsAtbCaptcha {
286+ pageurl : string ,
287+ appId : string ,
288+ apiServer : string ,
289+ pingback ?: string ,
290+ proxy ?: string ,
291+ proxytype ?: string
292+ }
293+
285294/**
286295 * An object containing properties of the captcha solution.
287296 * @typedef {Object } CaptchaAnswer
@@ -1780,6 +1789,68 @@ public async tencent(params: paramsTencent): Promise<CaptchaAnswer> {
17801789 }
17811790}
17821791
1792+ /**
1793+ * ### Solves a atbCAPTCHA.
1794+ *
1795+ * Use this method to solve atbCAPTCHA captcha. Returns a token.
1796+ * [Read more about atbCAPTCHA](https://2captcha.com/2captcha-api#atb-captcha).
1797+ *
1798+ * @param {{ pageurl, appId, apiServer, pingback, proxy, proxytype } } params Parameters for solving atbCAPTCHA as an object.
1799+ * @param {string } params.pageurl The URL where the captcha is located.
1800+ * @param {string } params.appId The value of `appId` parameter in the website source code.
1801+ * @param {string } params.apiServer The value of `apiServer` parameter in the website source code.
1802+ * @param {string } [params.pingback] Optional param. URL for pingback (callback) response when captcha is solved.
1803+ * @param {string } [params.proxy] Optional param. Proxy to use while solving the captcha. Format: `login:password@123.123.123.123:3128`.
1804+ * @param {string } [params.proxytype] Optional param. Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
1805+ *
1806+ * @returns {Promise<CaptchaAnswer> } The result from the solve.
1807+ * @throws APIError
1808+ *
1809+ * @example
1810+ * solver.atbCaptcha({
1811+ * pageurl: "https://mysite.com/page/with/tencent",
1812+ * appId: "af25e409b33d722a95e56a230ff8771c",
1813+ apiServer: "https://cap.aisecurius.com"
1814+ * })
1815+ * .then((res) => {
1816+ * console.log(res);
1817+ * })
1818+ * .catch((err) => {
1819+ * console.log(err);
1820+ * })
1821+ */
1822+ public async atbCaptcha ( params : paramsAtbCaptcha ) : Promise < CaptchaAnswer > {
1823+ params = await renameParams ( params )
1824+ checkCaptchaParams ( params , "atb_captcha" )
1825+
1826+ const payload = {
1827+ ...params ,
1828+ method : "atb_captcha" ,
1829+ ...this . defaultPayload ,
1830+ }
1831+
1832+ const URL = this . in
1833+ const response = await fetch ( URL , {
1834+ body : JSON . stringify ( payload ) ,
1835+ method : "post" ,
1836+ headers : { 'Content-Type' : 'application/json' }
1837+ } )
1838+ const result = await response . text ( )
1839+
1840+ let data ;
1841+ try {
1842+ data = JSON . parse ( result )
1843+ } catch {
1844+ throw new APIError ( result )
1845+ }
1846+
1847+ if ( data . status == 1 ) {
1848+ return this . pollResponse ( data . request )
1849+ } else {
1850+ throw new APIError ( data . request )
1851+ }
1852+ }
1853+
17831854 /**
17841855 * Reports a captcha as correctly solved.
17851856 *
0 commit comments