@GamiD Вот функция, там всего один простой запрос, думаю разберешься
func getSolution(key, token string) (string, error) { url := fmt.Sprintf("https://www.google.com/recaptcha/api2/reload?k=%s", key) payload := fmt.Sprintf("reason=q&c=%s&size=invisible", token) resp, err := http.Post(url, "application/x-www-form-urlencoded", strings.NewReader(payload)) if err != nil { return "", err } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { return "", fmt.Errorf("Failed to retrieve solution: %v", resp.Status) } // Read the response body body, err := io.ReadAll(resp.Body) if err != nil { return "", err } re := regexp.MustCompile(`"rresp","(.*?)",`) match := re.FindStringSubmatch(string(body)) if len(match) < 2 { return "", fmt.Errorf("Failed to extract 'rresp' value from the response body") } solution := match[1] return solution, nil }Ошибка Telegram+Recaptcha 2
-
У меня почему то возникла ошибка при использовании разгадывания капчи, через rucaptcha-newapi, если не выполнять действие с оповещением по телеграму, то ошибки нет, может у меня у одного такое случилось, есть еще у кого такое?
[394329983] [03:52:21] Поток №1 : TypeError: Result of expression 'url' [https://api.telegram.org/bot427128908:AAFkB6pgkWbYz2kfV_0dAgooMQG2vYbhuc8/sendMessage?chat_id=3244&text=<b>[03:52:03] </b>%D0%A2%D1%80%D0%B5%D0%B1%D1%83%D0%B5%D1%82%D1%81%D1%8F%20%D0%B2%D0%B2%D0%B5%D1%81%D1%82%D0%B8%20%D1%80%D0%B5%D0%BA%D0%B0%D0%BF%D1%87%D1%83&parse_mode=HTML] is not a function. Номер строки:73 Во время выполнения скрипта NEWAPI_DATA_SITEKEY = _result().split(new RegExp("[\?\&]k=")) NEWAPI_DATA_SITEKEY = NEWAPI_DATA_SITEKEY[NEWAPI_DATA_SITEKEY.length - 1] NEWAPI_DATA_SITEKEY = NEWAPI_DATA_SITEKEY.split("&")[0] NEWAPI_DATA_SITEKEY = NEWAPI_DATA_SITEKEY.split("#")[0] if(NEWAPI_DATA_SITEKEY.length == 0) { fail("data-sitekey is empty") } url(function(){ NEWAPI_URL = _result() NEWAPI_METHOD = (BAS_SolveRecaptcha_Method).replace("-newapi","") NEWAPI_RES = "" _if_else(BAS_SolveRecaptcha_Method == "antigate-newapi", function(){ _switch_http_client_internal() var data = JSON.stringify({"clientKey":BAS_SolveRecaptcha_Rucaptcha,softId:"784","task":{"type":"NoCaptchaTaskProxyless","websiteURL":NEWAPI_URL,"websiteKey":NEWAPI_DATA_SITEKEY}}) http_client_post("https://api.anti-captcha.com/createTask", ["data",data], {"content-type":("custom"), "encoding":("UTF-8"), "method":("POST")},function(){ var resp = JSON.parse(http_client_content()) if(resp["errorId"]!==0) fail(resp["errorDescription"]) NEWAPI_TASK_ID = parseInt(resp["taskId"]) _do(function(){ if(_iterator() > 60) fail("Recaptcha 2 antigate wait res timeout") var data = JSON.stringify({"clientKey":BAS_SolveRecaptcha_Rucaptcha,"taskId":NEWAPI_TASK_ID}) http_client_post("https://api.anti-captcha.com/getTaskResult", ["data",data], {"content-type":("custom"), "encoding":("UTF-8"), "method":("POST")},function(){ var resp = JSON.parse(http_client_content()) if(resp["errorId"]!==0) fail(resp["errorDescription"]) if(resp["status"] === "ready") { NEWAPI_RES = resp["solution"]["gRecaptchaResponse"] _break() } sleep(5000,function(){ })})},function(){ _switch_http_client_main() })})}, function(){ solver_property(NEWAPI_METHOD,"method","userrecaptcha") solver_property(NEWAPI_METHOD,"googlekey",NEWAPI_DATA_SITEKEY) solver_property(NEWAPI_METHOD,"pageurl",NEWAPI_URL) solve_base64(NEWAPI_METHOD, "",function(){ NEWAPI_RES = _result() })},function(){ get_element_selector(RECAPTCHA_PREFIX).script("Array.prototype.slice.call(document.getElementsByClassName('g-recaptcha-response')).forEach(function(el){el.value = " + JSON.stringify(NEWAPI_RES) + "});BrowserAutomationStudio_RecaptchaSolved(" + JSON.stringify(NEWAPI_RES) + ");",function(){ get_element_selector(RECAPTCHA_PREFIX).script("document.getElementsByClassName('g-recaptcha')[0].getAttribute('data-callback')",function(){ _if(_result().length > 0, function(){ get_element_selector(RECAPTCHA_PREFIX).script(_result() + '(' + JSON.stringify(NEWAPI_RES) + ");",function(){ })},function(){ })})})})});