
    i                         S SK Jr  S SKrS SKr S SKrSSKJrJrJ	r	J
r
JrJr  SSKJr   " S S	\5      r\" 5         g! \ a	    \" S5      ef = f)
    )absolute_importNzlPlease install the python module 'polling' via pip or download it from https://github.com/justiniso/polling/   )CaptchaExceptionCaptchaServiceUnavailableCaptchaAPIErrorCaptchaTimeoutCaptchaParameterCaptchaBadJobID   )Captchac                   J   ^  \ rS rSrU 4S jr\S 5       rS rS rS r	Sr
U =r$ )captchaSolver   c                    > [         [        U ]  S5        SU l        SU l        [
        R                  " 5       U l        SSS.U l        g )N9kwzhttps://www.9kw.eu/index.cgi   recaptchav2hcaptcha)	reCaptchahCaptcha)	superr   __init__host
maxtimeoutrequestsSessionsessioncaptchaType)self	__class__s    E/app/mltbenv/lib/python3.13/site-packages/cloudscraper/captcha/9kw.pyr   captchaSolver.__init__   s@    mT+E22	'')&"
    c           	      z   U R                   S;   a  [        SU R                    35      e0 SS_SS_SS_S	S
_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS _S!S"_S#S$_0 S%S_S&S'_S(S)_S*S+_S,S-_S.S/_S0S1_S2S3_S4S5_S6S7_S8S9_S:S;_S<S=_S>S?_S@SA_SBSC_SDSE_E0 SFSG_SHSI_SJSK_SLSM_SNSO_SPSQ_SRSS_STSU_SVSW_SXSY_SZS[_S\S]_S^S__S`Sa_SbSc_SdSe_SfSg_EShSiSjSk.EnU R                  R                  Sl5      (       ae  U R	                  5       R                  Sm5      (       a@  [        UR                  [        U R	                  5       R                  Sm5      5      5      5      eg [        [        R                  " SnU R                  5      R                  5       R                  SoSp5      5      nU(       a  [        UR                  U5      5      eg )qN)i  i  z9kw: Server Side Error r   zNo API Key available.r   zNo API key found.   zNo active API key found.   z+API Key has been disabled by the operator.    zNo user found.   zNo data found.   zFound No ID.   zfound No captcha.	   zNo image found.
   zImage size not allowed.   zcredit is not sufficient.   zwhat was done.   zNo answer contain.   zCaptcha already been answered.   zCaptcha to quickly filed.   zJD check active.   zUnknown problem.      zIncorrect answer.   z'Do not timely filed (Incorrect UserID).   zLink not allowed.   zProhibited submit.   zEntering prohibited.   zToo little credit.   zNo entry found.r   zNo Conditions accepted.   z%No coupon code found in the database.   zAlready unused voucher code.   zmaxTimeout under 60 seconds.   zUser not found.   z)An account is not yet 24 hours in system.    z)An account does not have the full rights.!   zPlugin needed a update."   zNo HTTPS allowed.#   zNo HTTP allowed.$   zSource not allowed.%   zTransfer denied.&   zIncorrect answer without space'   zIncorrect answer with space(   z&Incorrect answer with not only numbers)   z'Incorrect answer with not only A-Z, a-z*   z,Incorrect answer with not only 0-9, A-Z, a-z+   z'Incorrect answer with not only [0-9,- ],   z-Incorrect answer with not only [0-9A-Za-z,- ]-   z*Incorrect answer with not only coordinates.   z3Incorrect answer with not only multiple coordinates/   z#Incorrect answer with not only data0   z,Incorrect answer with not only rotate number1   z#Incorrect answer with not only text2   z1Incorrect answer with not only text and too short3   z&Incorrect answer with not enough charsz$Incorrect answer with too many charsz"Incorrect answer without no or yeszAssignment was not found.)4   5   6   {errorz^00(?P<error_code>\d+)
error_coder   )status_coder   text
startswithjsongetr   intresearch	groupdict)responseerror_codesrZ   s      r!   checkErrorStatuscaptchaSolver.checkErrorStatus(   s   :-+)(*>*>)?@ 7
&7
"7
 )7
 <	7

 7
 7
 ~7
 "7
  7
 )7
 +7
  7
 $7
 07
 +7
  "!7
" "#7
$ %7
& #'7
( 9)7
* #+7
, $-7
. &/7
0 $17
2 !37
4 )57
6 777
8 .97
: .;7
< !=7
> ;?7
@ ;A7
B )C7
D #E7
F "G7
H %I7
J "K7
L 0M7
N -O7
P 8Q7
R 9S7
T >U7
V 9W7
X ?Y7
Z <[7
\ E]7
^ 5_7
` >a7
b 5c7
d Ce7
f 8g7
h 74+m7
r ==##C((}}""7++%kooc(--/:M:Mg:V6W&XYY , RYY'@(--PZZ\``amopqrJ%kooj&ABB r#   c                    ^ ^ T(       d  [        S5      eU 4S jn[        R                  " UU 4S jUST R                  S-   S9nU(       a  UR	                  5       R                  S5      $ [        S5      e)Nz)9kw: Error bad job id to request against.c                    > U R                   (       a%  U R                  5       R                  S5      S:w  a  U $ TR                  U 5        g )NanswerzNO DATA)okr^   r_   rf   rd   r   s    r!   _checkRequest/captchaSolver.requestJob.<locals>._checkRequestx   s8    {{x}}228<	I!!(+r#   c            	      l   > TR                   R                  TR                  TR                  ST SSS.S9$ )Nusercaptchacorrectdatar   )apikeyactionidinfor^   )params)r   r_   r   api_key)jobIDr   s   r!   <lambda>*captchaSolver.requestJob.<locals>.<lambda>   s8    DLL$$		"ll6 % 	r#   r,   check_successsteptimeoutrj   z9kw: Error failed to solve.)r
   pollingpollr   r^   r_   r   )r   rw   rm   rd   s   ``  r!   
requestJobcaptchaSolver.requestJobr   sl    !; 	 <<	 (__r)
  ==?&&x00 !>??r#   c                    ^ ^^^ U 4S jn[         R                  " UU UU4S jUST R                  S-   S9nU(       a  UR                  5       R	                  S5      $ [        S5      e)Nc                    > U R                   (       aF  U R                  R                  S5      (       a&  U R                  5       R	                  S5      (       a  U $ TR                  U 5        g )NrX   	captchaid)rk   r\   r]   r^   r_   rf   rl   s    r!   rm   1captchaSolver.requestSolve.<locals>._checkRequest   sK    {{x}}77<<ATATU`AaAa!!(+r#   c                     > TR                   R                  TR                  TR                  SSTTR                  T    TTR
                  SS.SS9$ )Nusercaptchauploadr   )rq   rr   interactivezfile-upload-01	oldsourcepageurlr   r^   F)dataallow_redirects)r   postr   rv   r   r   )r   r   siteKeyurls   r!   rx   ,captchaSolver.requestSolve.<locals>.<lambda>   sU    DLL%%		"ll1#$&-!%!1!1+!>""&//	 !& & r#   r'   r,   rz   r   z(9kw: Error no valid job id was returned.)r~   r   r   r^   r_   r
   )r   r   r   r   rm   rd   s   ````  r!   requestSolvecaptchaSolver.requestSolve   sY    	 << (__r)#
( ==?&&{33!"LMMr#   c                 
   S nUR                  S5      (       d  [        S5      eUR                  S5      U l        UR                  S5      (       a  UR                  S5      U l        UR                  S5      (       a   UR                  S5      U R                  l        XR                  ;  a  [        SU S35      e U R                  XU5      nU R                  U5      $ ! [        R                   a    [        SU S	35      ef = f)
Nrv   z9kw: Missing api_key parameter.r   proxyproxiesz9kw: z# is not supported by this provider.z/9kw: solve took to long to execute 'captchaid' z, aborting.)r_   r	   rv   r   r   r   r   r   r   r   r~   TimeoutExceptionr   )r   r   r   r   captchaParamsrw   s         r!   getCaptchaAnswercaptchaSolver.getCaptchaAnswer   s      ++"#DEE$((3\**+//=DOW%%#0#4#4Y#?DLL ..."U;-7Z#[\\	%%k@E??5))'' 	 A%T 	s   ;"C $D)rv   r   r   r   r   )__name__
__module____qualname____firstlineno__r   staticmethodrf   r   r   r   __static_attributes____classcell__)r    s   @r!   r   r      s9    
 EC ECR!@J NF r#   r   )
__future__r   ra   r   r~   ImportError
exceptionsr   r   r   r   r	   r
    r   r    r#   r!   <module>r      s_    & 	   wG wx ]  
	0 s	   = A