@@ -34,6 +34,100 @@ class TimeoutException(SolverExceptions):
34
34
35
35
36
36
class TwoCaptcha ():
37
+ """
38
+ Class for interacting with the 2captcha API.
39
+
40
+ This class provides methods for solving various types of CAPTCHAs, such as image CAPTCHAs, audio CAPTCHAs, reCAPTCHAs,
41
+ hCAPTCHAs, and others. It handles sending CAPTCHAs to the 2captcha service and retrieving the solution.
42
+
43
+ Parameters
44
+ __________
45
+ API_KEY : str
46
+ Your personal API key for accessing the 2captcha API.
47
+ soft_id : int, optional
48
+ Software ID obtained after publishing in the 2captcha software catalog. Default is 4580.
49
+ callback : str, optional
50
+ URL of your server to receive the result of the captcha recognition via callback.
51
+ It must be registered in your 2captcha account settings. Default is None.
52
+ default_timeout : int, optional
53
+ The timeout (in seconds) for polling responses for normal CAPTCHAs, excluding reCAPTCHA. Default is 120.
54
+ recaptcha_timeout : int, optional
55
+ The timeout (in seconds) for polling responses specifically for reCAPTCHAs. Default is 600.
56
+ polling_interval : int, optional
57
+ The interval (in seconds) between requests to the 2captcha API for retrieving the captcha solution. Default is 10.
58
+ api_client : ApiClient
59
+ An instance of the ApiClient class to handle API requests.
60
+ max_files : int
61
+ Maximum number of files that can be sent to the API in one request. Default is 9.
62
+ exceptions : SolverExceptions
63
+ Custom exceptions for handling API errors.
64
+ extendedResponse : bool, optional
65
+ If True, enables extended responses from the 2captcha API, which provides more detailed result data. Default is None.
66
+
67
+ Methods
68
+ _______
69
+ normal(file, **kwargs)
70
+ To bypass a normal captcha (distorted text on an image) use the following method. This method can also be used
71
+ to recognize any text in an image.
72
+ audio(file, lang, **kwargs)
73
+ Use the following method to bypass an audio captcha (mp3 formats only).
74
+ text(text, **kwargs)
75
+ This method can be used to bypass a captcha that requires answering a question provided in clear text.
76
+ recaptcha(sitekey, url, version='v2', enterprise=0, **kwargs)
77
+ Use the following method to solve reCAPTCHA V2 or V3 and obtain a token to bypass the protection.
78
+ funcaptcha(sitekey, url, **kwargs)
79
+ FunCaptcha (Arkoselabs) solving method. Returns a token.
80
+ geetest(gt, challenge, url, **kwargs)
81
+ Method to solve GeeTest puzzle captcha. Returns a set of tokens as JSON.
82
+ hcaptcha(sitekey, url, **kwargs)
83
+ Use this method to solve the hCaptcha challenge. Returns a token to bypass the captcha.
84
+ keycaptcha(s_s_c_user_id, s_s_c_session_id, s_s_c_web_server_sign, s_s_c_web_server_sign2, url, **kwargs)
85
+ Token-based method to solve KeyCaptcha.
86
+ capy(sitekey, url, **kwargs)
87
+ Token-based method to bypass Capy puzzle captcha.
88
+ grid(file, **kwargs)
89
+ The grid method was originally called the Old reCAPTCHA V2 method. The method can be used to bypass any type of
90
+ captcha where you can apply a grid on an image and click specific grid boxes. Returns numbers of boxes.
91
+ canvas(file, **kwargs)
92
+ The canvas method can be used when you need to draw a line around an object on an image. Returns a set of points'
93
+ coordinates to draw a polygon.
94
+ coordinates(file, **kwargs)
95
+ The ClickCaptcha method returns the coordinates of points on the captcha image. It can be used if you need to
96
+ click on particular points in the image.
97
+ rotate(files, **kwargs)
98
+ This method can be used to solve a captcha that asks to rotate an object. It is mostly used to bypass FunCaptcha.
99
+ Returns the rotation angle.
100
+ geetest_v4(captcha_id, url, **kwargs)
101
+ Use this method to solve GeeTest v4. Returns the response in JSON.
102
+ lemin(captcha_id, div_id, url, **kwargs)
103
+ Use this method to solve the Lemin captcha. Returns JSON with an answer containing the following values: answer,
104
+ challenge_id.
105
+ atb_captcha(app_id, api_server, url, **kwargs)
106
+ Use this method to solve atbCaptcha challenge. Returns a token to bypass the captcha.
107
+ turnstile(sitekey, url, **kwargs)
108
+ Use this method to solve Cloudflare Turnstile. Returns JSON with the token.
109
+ amazon_waf(sitekey, iv, context, url, **kwargs)
110
+ Use this method to solve Amazon WAF Captcha also known as AWS WAF Captcha is a part of Intelligent threat
111
+ mitigation for Amazon AWS. Returns JSON with the token.
112
+ mtcaptcha(sitekey, url, **kwargs)
113
+ Use this method to solve MTCaptcha and obtain a token to bypass the protection.
114
+ friendly_captcha(sitekey, url, **kwargs)
115
+ Friendly Captcha solving method. Returns a token.
116
+ tencent(app_id, url, **kwargs)
117
+ Use this method to solve Cutcaptcha. Returns a token.
118
+ cutcaptcha(misery_key, apikey, url, **kwargs)
119
+ Use this method to solve Cutcaptcha. Returns the response in JSON.
120
+ datadome(captcha_url, pageurl, userAgent, proxy, **kwargs)
121
+ Use this method to solve DataDome captcha.
122
+ cybersiara(master_url_id, pageurl, userAgent, **kwargs)
123
+ Use this method to solve CyberSiARA. Returns a token.
124
+ solve(timeout=0, polling_interval=0, **kwargs)
125
+ Sends CAPTCHA data and retrieves the result.
126
+ balance()
127
+ Retrieves the balance of your 2captcha account.
128
+ report(id_, correct)
129
+ Reports the correctness of a solved CAPTCHA.
130
+ """
37
131
def __init__ (self ,
38
132
apiKey ,
39
133
softId = 4580 ,
0 commit comments