feature: действие typing — ввод как у человека, кириллица (#14)

fill остаётся мгновенным. typing подводит курсор по кривой, кликает в поле, стирает
старое значение и набирает текст посимвольно с паузами; символы вне раскладки
(кириллица) больше не роняют ввод. Значение typing маскируется в логах.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
protokeyandClaude Opus 5.5 committed 2026-10-13 20:58:09 +04:00
1 parent 49a2f3024a
commit 1075267d27
8 files changed
+74 -25

No files matched your search

+7
View File
@@ -4,6 +4,7 @@ import time
from patchright.async_api import Page
from antibot.humanize import typing as human_typing
from antibot.orchestrator import pass_challenges
from captcha import load_captcha
from api.schemas import ActionRequest
@@ -32,6 +33,12 @@ async def fill(page: Page, act: ActionRequest, **kwargs) -> str | None:
await page.fill(act.selector, act.value)
@register
async def typing(page: Page, act: ActionRequest, **kwargs) -> str | None:
"""В отличие от fill — как человек: подвод мыши, клик, посимвольный ввод с паузами (#14)."""
await human_typing(page, act.selector, act.value)
@register
async def captcha(page: Page, act: ActionRequest, captcha_key: str, **kwargs) -> str | None:
captcha_solver = load_captcha(captcha_key, act.value)
+1 -1
View File
@@ -21,7 +21,7 @@ def safe_request_dump(payload: SolveRequest) -> str:
if payload.cookies:
data["cookies"] = [c.get("name") for c in payload.cookies]
for act in data["actions"]:
if act["type"] == "fill" and "value" in act:
if act["type"] in ("fill", "typing") and "value" in act:
act["value"] = "***"
return json.dumps(data, indent=2, ensure_ascii=False)
+1
View File
@@ -11,6 +11,7 @@ PROXY_SCHEMES = ("http", "https", "socks5")
# тип действия -> обязательные поля (кроме type)
_REQUIRED_FIELDS: dict[str, tuple[str, ...]] = {
"fill": ("selector", "value"),
"typing": ("selector", "value"),
"captcha": ("selector", "value"),
"delay": ("value",),
"mouse_move": ("selector",),