TSPD¶
To import this module:
from python_rucaptcha.tspd_captcha import TSPDCaptcha
- class python_rucaptcha.tspd_captcha.TSPDCaptcha(websiteURL: str, tspdcookie: str, htmlPageBase64: str, proxyType: str, proxyAddress: str, proxyPort: int, method: str | TSPDEnm = TSPDEnm.TspdTask, proxyLogin: str | None = None, proxyPassword: str | None = None, userAgent: str | None = None, *args, **kwargs)¶
Solve the cookie-based TSPD captcha using a static proxy session.
- __init__(websiteURL: str, tspdcookie: str, htmlPageBase64: str, proxyType: str, proxyAddress: str, proxyPort: int, method: str | TSPDEnm = TSPDEnm.TspdTask, proxyLogin: str | None = None, proxyPassword: str | None = None, userAgent: str | None = None, *args, **kwargs)¶
- Parameters:
rucaptcha_key – User API key.
websiteURL (str) – Full URL of the page where TSPD is loaded.
tspdcookie (str) – Cookies received from the TSPD challenge page.
htmlPageBase64 (str) – Full challenge-page HTML encoded as Base64.
proxyType (str) – Proxy type:
http,socks4orsocks5.proxyAddress (str) – Proxy IP address or hostname.
proxyPort (int) – Proxy port.
method (str | TSPDEnm) – Captcha task type. Only
tspdtaskis supported.proxyLogin (str | None) – Optional proxy login.
proxyPassword (str | None) – Optional proxy password.
userAgent (str | None) – Browser User-Agent used to load the page.
kwargs – Additional task parameters.
Notes
The proxy must use a static session and the same outbound IP must be maintained while obtaining cookies, solving the task, and using the returned cookies.
- captcha_handler(**kwargs) dict¶
Synchronously submit and poll the TSPD task.
- async aio_captcha_handler() dict¶
Asynchronously submit and poll the TSPD task.
Usage notes¶
TSPD requires a static proxy session. Obtain the challenge HTML and cookies through that proxy immediately before creating the task, then keep the same outbound IP when applying the returned cookies.
htmlPageBase64 must contain the complete challenge HTML encoded as Base64.
The solution cookies are returned under solution.Domains and
solution.Domains[domain].Cookies.