Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
Add slow typing for audio recogntion response to avoid detection.
Browse files Browse the repository at this point in the history
  • Loading branch information
thicccat688 committed Mar 1, 2023
1 parent 0cb1ebb commit 5b8205b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion selenium_recaptcha_solver/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import speech_recognition as sr
import requests
import tempfile
import random
import time
import os

from .delay_config import DelayConfig, StandardDelayConfig
Expand Down Expand Up @@ -206,7 +208,7 @@ def _solve_audio_challenge(self) -> None:
if self._delay_config:
self._delay_config.delay_before_type_answer()

response_textbox.send_keys(recognized_text)
self._human_type(element=response_textbox, text=recognized_text)

if self._delay_config:
self._delay_config.delay_after_type_answer()
Expand Down Expand Up @@ -238,6 +240,19 @@ def _wait_for_element(

return WebDriverWait(self._driver, timeout).until(ec.visibility_of_element_located((by, locator)))

@staticmethod
def _human_type(element: WebElement, text: str) -> None:
"""
Types in a way reminiscent of a human, with a random delay in between 50ms to 100ms for every character
:param element: Input element to type text to
:param text: Input to be typed
"""

for c in text:
element.send_keys(c)

time.sleep(random.uniform(0.05, 0.1))


# Add alias for backwards compatibility
API = RecaptchaSolver
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='selenium-recaptcha-solver',
version='1.2.1',
version='1.2.3',
license='MIT',
author='Tomás Perestrelo',
author_email='[email protected]',
Expand Down

0 comments on commit 5b8205b

Please sign in to comment.