/// <inheritdoc /> public override string SolveCaptcha(Bitmap bitmap) { // Create task using (CWebClient client = new CWebClient()) { if (Timeout > 0) { client.Timeout = Timeout; } client.Headers.Add(HttpRequestHeader.ContentType, "application/json"); var response = client.UploadString("https://api.anti-captcha.com/createTask", JsonConvert.SerializeObject(new CreateCaptchaTaskRequest(ApiKey, GetBase64(bitmap, ImageFormat.Png)))); CreateTaskResponse ctr = JsonConvert.DeserializeObject <CreateTaskResponse>(response); if (ctr.errorId > 0) { throw new Exception(ctr.errorCode); } TaskId = ctr.taskId; Status = CaptchaStatus.Processing; // Check if task has been completed DateTime start = DateTime.Now; while (Status == CaptchaStatus.Processing && (DateTime.Now - start).TotalSeconds < Timeout) { Thread.Sleep(5000); client.Headers.Add(HttpRequestHeader.ContentType, "application/json"); response = client.UploadString("https://api.anti-captcha.com/getTaskResult", JsonConvert.SerializeObject(new GetTaskResultRequest(ApiKey, TaskId))); GetTaskResultCaptchaResponse gtrr = JsonConvert.DeserializeObject <GetTaskResultCaptchaResponse>(response); if (gtrr.errorId > 0) { throw new Exception(gtrr.errorCode); } if (gtrr.status == "ready") { Status = CaptchaStatus.Completed; return(gtrr.solution.text); } } throw new TimeoutException(); } }
/// <inheritdoc /> public override string SolveRecaptcha(string siteKey, string siteUrl) { // Create task using (CWebClient client = new CWebClient()) { if (Timeout > 0) { client.Timeout = Timeout; } client.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded"); var res = client.UploadString("http://captchatypers.com/captchaapi/UploadRecaptchaToken.ashx", $"token={ApiKey}&action=UPLOADCAPTCHA&pageurl={siteUrl}&googlekey={siteKey}"); if (res.Contains("ERROR")) { throw new Exception(res); } TaskId = res; Status = CaptchaStatus.Processing; // Check if task has been completed DateTime start = DateTime.Now; while (Status == CaptchaStatus.Processing && (DateTime.Now - start).TotalSeconds < Timeout) { Thread.Sleep(5000); client.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded"); res = client.UploadString("http://captchatypers.com/captchaapi/GetRecaptchaTextToken.ashx", $"token={ApiKey}&action=GETTEXT&captchaID={TaskId}"); if (res.Contains("NOTDECODED")) { continue; } if (res.Contains("ERROR")) { throw new Exception(res); } Status = CaptchaStatus.Completed; return(res); } throw new TimeoutException(); } }
/// <inheritdoc /> public override double GetBalance() { using (CWebClient client = new CWebClient()) { if (Timeout > 0) { client.Timeout = Timeout; } client.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); var res = client.UploadString("http://captchatypers.com/Forms/RequestBalanceToken.ashx", $"token={ApiKey}&action=REQUESTBALANCE"); if (res.Contains("ERROR")) { throw new Exception(res); } return(double.Parse(res, CultureInfo.InvariantCulture)); } }
/// <inheritdoc /> public override double GetBalance() { using (CWebClient client = new CWebClient()) { if (Timeout > 0) { client.Timeout = Timeout; } client.Headers.Add(HttpRequestHeader.Accept, "application/json"); client.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded"); var response = client.UploadString("http://api.dbcapi.me/api/user", $"username={User}&password={Pass}"); GetBalanceResponse gbr = JsonConvert.DeserializeObject <GetBalanceResponse>(response); if (gbr.status != 0) { throw new Exception("Invalid Credentials"); } return(gbr.balance / 100); } }
/// <inheritdoc /> public override double GetBalance() { using (CWebClient client = new CWebClient()) { if (Timeout > 0) { client.Timeout = Timeout; } client.Headers.Add(HttpRequestHeader.ContentType, "application/json"); var response = client.UploadString("https://api.anti-captcha.com/getBalance", JsonConvert.SerializeObject(new GetBalanceRequest(ApiKey))); GetBalanceResponse gbr = JsonConvert.DeserializeObject <GetBalanceResponse>(response); if (gbr.errorId > 0) { throw new Exception(gbr.errorCode); } return(gbr.balance); } }
/// <inheritdoc /> public override string SolveCaptcha(Bitmap bitmap) { // Create task using (CWebClient client = new CWebClient()) { if (Timeout > 0) { client.Timeout = Timeout; } client.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded"); var res = client.UploadString("http://captchatypers.com/Forms/UploadFileAndGetTextNEWToken.ashx", $"token={ApiKey}&action=UPLOADCAPTCHA&chkCase=1&file={WebUtility.UrlEncode(GetBase64(bitmap, ImageFormat.Bmp))}"); if (res.Contains("ERROR")) { throw new Exception(res); } Status = CaptchaStatus.Completed; return(res.Split('|')[1]); } }
/// <inheritdoc /> public override string SolveCaptcha(Bitmap bitmap) { // Create task using (CWebClient client = new CWebClient()) { if (Timeout > 0) { client.Timeout = Timeout; } client.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded"); var response = client.UploadString("http://azcaptcha.com/in.php", $"key={ApiKey}&method=base64®sense=1&body={GetBase64(bitmap, ImageFormat.Bmp)}&json=1"); GenericResponse ctr = JsonConvert.DeserializeObject <GenericResponse>(response); if (ctr.status == 0) { throw new Exception(ctr.request); } TaskId = ctr.request; Status = CaptchaStatus.Processing; // Check if task has been completed DateTime start = DateTime.Now; while (Status == CaptchaStatus.Processing && (DateTime.Now - start).TotalSeconds < Timeout) { Thread.Sleep(5000); response = client.DownloadString($"http://azcaptcha.com/res.php?key={ApiKey}&action=get&id={TaskId}&json=1"); GenericResponse gtrr = JsonConvert.DeserializeObject <GenericResponse>(response); if (gtrr.request.Contains("NOTREADY")) { continue; } if (gtrr.status == 0) { throw new Exception(gtrr.request); } Status = CaptchaStatus.Completed; return(gtrr.request); } throw new TimeoutException(); } }
/// <inheritdoc /> public override string SolveCaptcha(Bitmap bitmap) { // Create task using (CWebClient client = new CWebClient()) { if (Timeout > 0) { client.Timeout = Timeout; } client.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded"); var response = client.UploadString("http://rucaptcha.com/in.php", $"key={ApiKey}&method=base64®sense=1&body={EscapeLongString(GetBase64(bitmap, ImageFormat.Bmp))}"); if (!response.StartsWith("OK")) { throw new Exception(response); } TaskId = response.Split('|')[1]; Status = CaptchaStatus.Processing; // Check if task has been completed DateTime start = DateTime.Now; while (Status == CaptchaStatus.Processing && (DateTime.Now - start).TotalSeconds < Timeout) { Thread.Sleep(5000); response = client.DownloadString($"http://rucaptcha.com/res.php?key={ApiKey}&action=get&id={TaskId}"); if (response.Contains("NOT_READY")) { continue; } if (response.Contains("ERROR")) { throw new Exception(response); } Status = CaptchaStatus.Completed; return(response.Split('|')[1]); } throw new TimeoutException(); } }