2captcha-python 1.2.1__py3-none-any.whl → 1.2.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: 2captcha-python
3
- Version: 1.2.1
3
+ Version: 1.2.3
4
4
  Summary: Python module for easy integration with 2Captcha API
5
5
  Home-page: https://github.com/2captcha/2captcha-python/
6
6
  Author: 2Captcha
@@ -23,6 +23,7 @@ The easiest way to quickly integrate [2Captcha] captcha solving service into you
23
23
  - [Solve captcha](#solve-captcha)
24
24
  - [Captcha options](#captcha-options)
25
25
  - [Normal Captcha](#normal-captcha)
26
+ - [Audio Captcha](#audio-captcha)
26
27
  - [Text Captcha](#text-captcha)
27
28
  - [ReCaptcha v2](#recaptcha-v2)
28
29
  - [ReCaptcha v3](#recaptcha-v3)
@@ -39,6 +40,9 @@ The easiest way to quickly integrate [2Captcha] captcha solving service into you
39
40
  - [Canvas](#canvas)
40
41
  - [ClickCaptcha](#clickcaptcha)
41
42
  - [Rotate](#rotate)
43
+ - [MTCaptcha](#mtcaptcha)
44
+ - [Friendly Captcha](#friendly_captcha)
45
+ - [Cutcaptcha](#cutcaptcha)
42
46
  - [Other methods](#other-methods)
43
47
  - [send / getResult](#send--getresult)
44
48
  - [balance](#balance)
@@ -118,6 +122,16 @@ result = solver.normal('path/to/captcha.jpg', param1=..., ...)
118
122
  result = solver.normal('https://site-with-captcha.com/path/to/captcha.jpg', param1=..., ...)
119
123
  ```
120
124
 
125
+ ### Audio Captcha
126
+ To bypass an audio captcha (mp3 formats only) use the following method.
127
+ You must provife the language as `lang = 'en'`. Supported languages are "en", "ru", "de", "el", "pt".
128
+
129
+ ```python
130
+ result = solver.audio('path/to/captcha.mp3', lang = 'lang', param1=..., ...)
131
+ # OR
132
+ result = solver.audio('https://site-with-captcha.com/path/to/captcha.mp3', lang = 'lang', param1=..., ...)
133
+ ```
134
+
121
135
  ### Text Captcha
122
136
  This method can be used to bypass a captcha that requires to answer a question provided in clear text.
123
137
  ```python
@@ -197,8 +211,10 @@ Use this method to solve Cloudflare Turnstile. Returns JSON with the token.
197
211
  ```python
198
212
  result = solver.turnstile(sitekey='0x1AAAAAAAAkg0s2VIOD34y5',
199
213
  url='http://mysite.com/',
200
- param1=..., ...)
201
-
214
+ data='foo',
215
+ pagedata='bar',
216
+ action='challenge',
217
+ useragent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36')
202
218
  ```
203
219
 
204
220
  ### Amazon WAF
@@ -255,6 +271,32 @@ This method can be used to solve a captcha that asks to rotate an object. Mostly
255
271
  result = solver.rotate('path/to/captcha.jpg', param1=..., ...)
256
272
  ```
257
273
 
274
+ ### MTCaptcha
275
+ Use this method to solve MTCaptcha and obtain a token to bypass the protection.
276
+ ```python
277
+ result = solver.mtcaptcha(sitekey='MTPublic-KzqLY1cKH',
278
+ url='https://2captcha.com/demo/mtcaptcha',
279
+ param1=..., ...)
280
+ ```
281
+
282
+ ### Friendly Captcha
283
+ Friendly Captcha solving method. Returns a token.
284
+ ```python
285
+ result = solver.friendly_captcha(sitekey='FCMGEMUD2KTDSQ5H',
286
+ url='https://friendlycaptcha.com/demo',
287
+ param1=..., ...)
288
+ ```
289
+
290
+ ### Cutcaptcha
291
+ Use this method to solve Cutcaptcha. Returns the response in JSON.
292
+ ```python
293
+ result = solver.cutcaptcha(misery_key='ad52c87af17e2ec09b8d918c9f00416b1cb8c320',
294
+ apikey='SAs61IAI',
295
+ url='https://mysite.com/page/with/cutcaptcha',
296
+ param1=..., ...)
297
+ ```
298
+
299
+
258
300
  ## Other methods
259
301
 
260
302
  ### send / getResult
@@ -0,0 +1,8 @@
1
+ twocaptcha/__init__.py,sha256=5A1YhRuG_zytoi01RcsxoW87Ix_ee5zN5VYap-lJsb0,193
2
+ twocaptcha/api.py,sha256=qgv1y4FpajF2QZZ_Nzd4_Dcm7Dhk4I1LMAGubydg8zA,2763
3
+ twocaptcha/solver.py,sha256=gqReuWENkHC1Ao4ykWfRjrtjjY_7zeBvffjPHGlOLPg,19639
4
+ 2captcha_python-1.2.3.dist-info/LICENSE,sha256=sbILKjQcxUC6dAvBbivnRX9YCshBI9XRvvk1LGkpMEo,1065
5
+ 2captcha_python-1.2.3.dist-info/METADATA,sha256=7jmH9xEhmIX0qfxe3U_Vpd7BPkrG7f3OTE8OW34goN4,15429
6
+ 2captcha_python-1.2.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
7
+ 2captcha_python-1.2.3.dist-info/top_level.txt,sha256=AvFZdM89oM6Vo97ZTxT9AxHWpwoO3_Qf5ORMV3NClFE,11
8
+ 2captcha_python-1.2.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.40.0)
2
+ Generator: bdist_wheel (0.43.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
twocaptcha/__init__.py CHANGED
@@ -2,4 +2,4 @@ from .api import ApiClient
2
2
  from .solver import (TwoCaptcha, SolverExceptions, ValidationException,
3
3
  NetworkException, ApiException, TimeoutException)
4
4
 
5
- __version__ = '1.2.1'
5
+ __version__ = '1.2.3'
twocaptcha/solver.py CHANGED
@@ -81,6 +81,39 @@ class TwoCaptcha():
81
81
  result = self.solve(**method, **kwargs)
82
82
  return result
83
83
 
84
+ def audio(self, file, lang, **kwargs):
85
+ '''
86
+ Wrapper for solving audio captcha
87
+
88
+ Required:
89
+ file (base64, or url to mp3 file)
90
+ lang ("en", "ru", "de", "el", "pt")
91
+
92
+ Optional params:
93
+ '''
94
+ method = "audio"
95
+
96
+ if not file:
97
+ raise ValidationException('File is none')
98
+ elif not '.' in file and len(file) > 50:
99
+ body = file
100
+ elif file.endswith(".mp3") and file.startswith("http"):
101
+ response = requests.get(file)
102
+ if response.status_code != 200:
103
+ raise ValidationException(f'File could not be downloaded from url: {file}')
104
+ body = b64encode(response.content).decode('utf-8')
105
+ elif file.endswith(".mp3"):
106
+ with open(file, "rb") as media:
107
+ body = b64encode(media.read()).decode('utf-8')
108
+ else:
109
+ raise ValidationException('File extension is not .mp3 or it is not a base64 string.')
110
+
111
+ if not lang or lang not in ("en", "ru", "de", "el", "pt"):
112
+ raise ValidationException(f'Lang not in "en", "ru", "de", "el", "pt". You send {lang}')
113
+
114
+ result = self.solve(body=body, method=method, **kwargs)
115
+ return result
116
+
84
117
  def text(self, text, **kwargs):
85
118
  '''
86
119
  Wrapper for solving text captcha
@@ -470,7 +503,67 @@ class TwoCaptcha():
470
503
 
471
504
  return result
472
505
 
506
+ def mtcaptcha(self, sitekey, url, **kwargs):
507
+ '''
508
+ Wrapper for solving MTCaptcha
509
+
510
+ Required:
511
+ sitekey
512
+ url
513
+
514
+ Optional params:
515
+ softId
516
+ callback
517
+ proxy = {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'})
518
+ '''
519
+
520
+ result = self.solve(sitekey=sitekey,
521
+ url=url,
522
+ method='mt_captcha',
523
+ **kwargs)
524
+ return result
525
+
526
+ def friendly_captcha(self, sitekey, url, **kwargs):
527
+ '''
528
+ Wrapper for solving Friendly Captcha
529
+
530
+ Required:
531
+ sitekey
532
+ url
533
+
534
+ Optional params:
535
+ softId
536
+ callback
537
+ proxy = {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'})
538
+ '''
539
+
540
+ result = self.solve(sitekey=sitekey,
541
+ url=url,
542
+ method='friendly_captcha',
543
+ **kwargs)
544
+ return result
545
+
546
+ def cutcaptcha(self, misery_key, apikey, url, **kwargs):
547
+ '''
548
+ Wrapper for solving Friendly Captcha
473
549
 
550
+ Required:
551
+ misery_key
552
+ apikey
553
+ url
554
+
555
+ Optional params:
556
+ softId
557
+ callback
558
+ proxy = {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'})
559
+ '''
560
+
561
+ result = self.solve(misery_key=misery_key,
562
+ api_key=apikey,
563
+ url=url,
564
+ method='cutcaptcha',
565
+ **kwargs)
566
+ return result
474
567
 
475
568
  def solve(self, timeout=0, polling_interval=0, **kwargs):
476
569
  '''
@@ -524,7 +617,7 @@ class TwoCaptcha():
524
617
 
525
618
  if not '.' in file and len(file) > 50:
526
619
  return {'method': 'base64', 'body': file}
527
-
620
+
528
621
  if file.startswith('http'):
529
622
  img_resp = requests.get(file)
530
623
  if img_resp.status_code != 200:
@@ -1,8 +0,0 @@
1
- twocaptcha/__init__.py,sha256=WDrUPm2kIDaX6kD0oDxaNWzFShtvUCjWGhX48E4w0dU,193
2
- twocaptcha/api.py,sha256=qgv1y4FpajF2QZZ_Nzd4_Dcm7Dhk4I1LMAGubydg8zA,2763
3
- twocaptcha/solver.py,sha256=N5JYJTC-r-A_P7Z-dbvUBVfu9X73KF9nYgohR7OrBTI,16728
4
- 2captcha_python-1.2.1.dist-info/LICENSE,sha256=sbILKjQcxUC6dAvBbivnRX9YCshBI9XRvvk1LGkpMEo,1065
5
- 2captcha_python-1.2.1.dist-info/METADATA,sha256=shV3NuyNAjaRp32SmxQ0tiLTby4bjqf7t0XwuMBTIb0,13749
6
- 2captcha_python-1.2.1.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
7
- 2captcha_python-1.2.1.dist-info/top_level.txt,sha256=AvFZdM89oM6Vo97ZTxT9AxHWpwoO3_Qf5ORMV3NClFE,11
8
- 2captcha_python-1.2.1.dist-info/RECORD,,