chore: добавлена поддержка решения капчи hcaptcha на формах
This commit is contained in:
1 parent
89b4dd2677
commit
f5871710ab
9 files changed
+186
-32
No files matched your search
@@ -0,0 +1,25 @@
|
||||
from playwright.async_api import Page
|
||||
from twocaptcha import TwoCaptcha
|
||||
|
||||
|
||||
class Captcha:
|
||||
ctype = "captcha"
|
||||
|
||||
def __init__(self, api_key: str):
|
||||
self._api_key: str = api_key
|
||||
self._solver = TwoCaptcha(api_key)
|
||||
|
||||
def get_balance(self) -> float:
|
||||
return self._solver.balance()
|
||||
|
||||
async def solve(self, selector: str, page: Page):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
def load_captcha(key, captcha_type) -> Captcha:
|
||||
for cls in Captcha.__subclasses__():
|
||||
if cls.ctype == captcha_type:
|
||||
break
|
||||
else:
|
||||
raise Exception("Invalid captcha type")
|
||||
return cls(key)
|
||||
Reference in new issue
Block a user