Yidun

To import this module:

from python_rucaptcha.yidun_captcha import YidunCaptcha
class python_rucaptcha.yidun_captcha.YidunCaptcha(websiteURL: str, websiteKey: str, method: str | YidunEnm = YidunEnm.YidunTaskProxyless, userAgent: str | None = None, yidunGetLib: str | None = None, yidunApiServerSubdomain: str | None = None, challenge: str | None = None, hcg: str | None = None, hct: int | None = None, proxyType: str | None = None, proxyAddress: str | None = None, proxyPort: int | None = None, proxyLogin: str | None = None, proxyPassword: str | None = None, *args, **kwargs)
__init__(websiteURL: str, websiteKey: str, method: str | YidunEnm = YidunEnm.YidunTaskProxyless, userAgent: str | None = None, yidunGetLib: str | None = None, yidunApiServerSubdomain: str | None = None, challenge: str | None = None, hcg: str | None = None, hct: int | None = None, proxyType: str | None = None, proxyAddress: str | None = None, proxyPort: int | None = None, proxyLogin: str | None = None, proxyPassword: str | None = None, *args, **kwargs)

The class is used to work with Yidun NECaptcha.

Parameters:
  • rucaptcha_key – User API key

  • websiteURL (str) – Full URL of the page where the captcha is loaded

  • websiteKey (str) – Value of the id (or sitekey) parameter from the page source or from the get?referer= / check?referer= network request

  • method (str | YidunEnm) – Captcha type (YidunTaskProxyless or YidunTask)

  • userAgent (str | None) – Browser User-Agent used to open the page

  • yidunGetLib (str | None) – Full URL of the JS file that loads the captcha. Recommended for Enterprise version.

  • yidunApiServerSubdomain (str | None) – Yidun API server subdomain without https://. Specify if using a custom server.

  • challenge (str | None) – Dynamic challenge parameter from network requests (Enterprise)

  • hcg (str | None) – Captcha hash used when forming the request (Enterprise)

  • hct (int | None) – Numeric timestamp identifier for Enterprise version validation (Unix milliseconds)

  • proxyType (str | None) – Proxy type (http, socks4, socks5) - required for YidunTask

  • proxyAddress (str | None) – Proxy IP or hostname - required for YidunTask

  • proxyPort (int | None) – Proxy port - required for YidunTask

  • proxyLogin (str | None) – Proxy login (optional)

  • proxyPassword (str | None) – Proxy password (optional)

Examples

>>> YidunCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
...             websiteURL="https://example.com/page-with-yidun",
...             websiteKey="0f743r3g1g...rz3grz0ym5",
...             method=YidunEnm.YidunTaskProxyless.value,
...             ).captcha_handler()
{
   "errorId":0,
   "status":"ready",
   "solution":{
      "token":"D19scz7n4VCU7b_...fRyEY-tXQ0cmS6laRKp_tZEyei_EUzc5M1IW0oxUHnZ4fBMH2a0jMPjOReiHVWBgkrcRYaOkQRasHlFejEToe7HZJy2jaGkxiB9b"
   },
   "cost":"0.003",
   "ip":"1.2.3.4",
   "createTime":1692863536,
   "endTime":1692863556,
   "solveCount":1,
   "taskId": 73243152973,
}
>>> await YidunCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
...                     websiteURL="https://example.com/page-with-yidun",
...                     websiteKey="0f743r3g1g...rz3grz0ym5",
...                     method=YidunEnm.YidunTask.value,
...                     proxyType="http",
...                     proxyAddress="1.2.3.4",
...                     proxyPort=8080,
...                     ).aio_captcha_handler()
{
   "errorId":0,
   "status":"ready",
   "solution":{
      "token":"D19scz7n4VCU7b_...fRyEY-tXQ0cmS6laRKp_tZEyei_EUzc5M1IW0oxUHnZ4fBMH2a0jMPjOReiHVWBgkrcRYaOkQRasHlFejEToe7HZJy2jaGkxiB9b"
   },
   "cost":"0.003",
   "ip":"1.2.3.4",
   "createTime":1692863536,
   "endTime":1692863556,
   "solveCount":1,
   "taskId": 73243152973,
}
Returns:

Dict with full server response

captcha_handler(**kwargs) dict

Sync solving method

Parameters:

kwargs – Parameters for the requests library

Returns:

Dict with full server response

Return type:

dict

Notes

Check class docstring for more info

async aio_captcha_handler() dict

Async solving method

Returns:

Dict with full server response

Return type:

dict

Notes

Check class docstring for more info