@@ -325,6 +325,19 @@ export interface paramsAudioCaptcha {
325325 pingback ?: string ,
326326}
327327
328+ export interface paramsYidun {
329+ pageurl : string ,
330+ sitekey : string ,
331+ userAgent ?: string ,
332+ yidunGetLib ?: string ,
333+ yidunApiServerSubdomain ?: string ,
334+ challenge ?: string ,
335+ hcg ?: string ,
336+ hct ?: number ,
337+ proxy ?: string ,
338+ proxytype ?: string ,
339+ }
340+
328341/**
329342 * An object containing properties of the captcha solution.
330343 * @typedef {Object } CaptchaAnswer
@@ -2338,14 +2351,79 @@ public async audio(params: paramsAudioCaptcha): Promise<CaptchaAnswer> {
23382351 }
23392352}
23402353
2354+ /**
2355+ * ### Solves Yidun NECaptcha
2356+ *
2357+ * This method can be used to solve Yidun NECaptcha. Returns a token.
2358+ * [Read more about Yidun NECaptcha Method](https://2captcha.com/2captcha-api#yidun).
2359+ *
2360+ * @param {{ pageurl, sitekey, userAgent, yidunGetLib, yidunApiServerSubdomain, challenge, hcg, hct, proxy, proxytype } } params Parameters Yidun NECaptcha as an object.
2361+ * @param {string } params.pageurl Full URL of the page where you see the captcha.
2362+ * @param {string } params.sitekey The value of `id` or `sitekey` parameter found on the page.
2363+ * @param {string } params.userAgent Optional. Browser User-Agent string.
2364+ * @param {string } params.yidunGetLib Optional. URL of the JavaScript file used to load the captcha.
2365+ * @param {string } params.yidunApiServerSubdomain Optional. Custom API server subdomain.
2366+ * @param {string } params.challenge Optional. Dynamic challenge value obtained from network requests.
2367+ * @param {string } params.hcg Optional. Captcha hash value.
2368+ * @param {number } params.hct Optional. Numeric timestamp identifier.
2369+ * @param {string } params.proxy Optional. Format: `login:password@123.123.123.123:3128`. You can find more info about proxies [here](https://2captcha.com/2captcha-api#proxies).
2370+ * @param {string } params.proxytype Optional. Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
2371+ *
2372+ * @returns {Promise<CaptchaAnswer> } The result from the solve.
2373+ * @throws APIError
2374+ *
2375+ * @example
2376+ * solver.yidun({
2377+ * pageurl: "https://mysite.com/page/with/yidun",
2378+ * sitekey: "your_site_key"
2379+ * })
2380+ * .then((res) => {
2381+ * console.log(res);
2382+ * })
2383+ * .catch((err) => {
2384+ * console.log(err);
2385+ * })
2386+ */
2387+ public async yidun ( params : paramsYidun ) : Promise < CaptchaAnswer > {
2388+ params = renameParams ( params )
2389+
2390+ checkCaptchaParams ( params , "yidun" )
2391+
2392+ const payload = {
2393+ ...this . defaultPayload ,
2394+ ...params ,
2395+ method : "yidun" ,
2396+ } ;
2397+
2398+ const response = await fetch ( this . in , {
2399+ body : JSON . stringify ( payload ) ,
2400+ method : "post" ,
2401+ headers : { "Content-Type" : "application/json" }
2402+ } )
2403+ const result = await response . text ( )
2404+
2405+ let data ;
2406+ try {
2407+ data = JSON . parse ( result )
2408+ } catch {
2409+ throw new APIError ( result )
2410+ }
2411+
2412+ if ( data . status == 1 ) {
2413+ return this . pollResponse ( data . request )
2414+ } else {
2415+ throw new APIError ( data . request )
2416+ }
2417+ }
2418+
23412419 /**
23422420 * Reports a captcha as correctly solved.
2343- *
2421+ *
23442422 * @param {string } id The ID of the captcha
23452423 * @throws APIError
23462424 * @example
23472425 * solver.goodReport("7031854546")
2348- *
2426+ *
23492427 */
23502428 public async goodReport ( id : string ) : Promise < void > {
23512429 const payload = {
0 commit comments