private string ImageTyperz() { ImagetyperzAPI i = new ImagetyperzAPI(StaticVars.ImageTyperzAPI); try { string id = i.submit_recaptcha("https://club.pokemon.com/us/pokemon-trainer-club/parents/sign-up", "6LdpuiYTAAAAAL6y9JNUZzJ7cF3F8MQGGKko1bCy"); while (i.in_progress(id)) { Thread.Sleep(10000); } return(i.retrieve_captcha(id)); } catch (Exception e) { if (e.Message.Contains("AUTHENTICATION_FAILED")) { StaticVars.LogText += e.Message + Environment.NewLine; captcha_stop = true; } return(""); } }
private string ImageTyperz(CaptchaAPI model) { ImagetyperzAPI i = new ImagetyperzAPI(model.api); try { string id = i.submit_recaptcha("https://club.pokemon.com/us/pokemon-trainer-club/parents/sign-up", "6LdpuiYTAAAAAL6y9JNUZzJ7cF3F8MQGGKko1bCy"); while (i.in_progress(id)) { Thread.Sleep(10000); } model.IncrementSuccess(); return(i.retrieve_captcha(id)); } catch (Exception e) { if (e.Message.Contains("AUTHENTICATION_FAILED")) { model.IncrementFail(); model.enabled = false; } return(""); } }
/// <summary> /// Private _run method /// </summary> private void _run() { var a = this._arguments; // for easier use local ImagetyperzAPI i; var token = a.get_token(); if (!string.IsNullOrWhiteSpace(token)) { i = new ImagetyperzAPI(token); } else { i = new ImagetyperzAPI(""); i.set_user_and_password(a.get_username(), a.get_password()); } switch (a.get_mode()) { case "1": // solve normal captcha // ------------------------- /*string captcha_file = a.get_captcha_file(); * if (string.IsNullOrWhiteSpace(captcha_file)) * throw new Exception("Invalid captcha file"); * bool cs = a.is_case_sensitive(); * string resp = i.solve_captcha(captcha_file, cs); * this.show_output(resp);*/ break; case "2": // submit recapthca // ---------------------------------------------------- string page_url = a.get_page_url(); if (string.IsNullOrWhiteSpace(page_url)) { throw new Exception("Invalid recaptcha pageurl"); } string site_key = a.get_site_key(); if (string.IsNullOrWhiteSpace(site_key)) { throw new Exception("Invalid recaptcha sitekey"); } string proxy = a.get_proxy(); string captcha_id = ""; // check proxy if (!string.IsNullOrWhiteSpace(proxy)) { captcha_id = i.submit_recaptcha(page_url, site_key, proxy); } else { captcha_id = i.submit_recaptcha(page_url, site_key); } this.show_output(captcha_id); break; case "3": // retrieve captcha string recaptcha_id = a.get_captcha_id(); if (string.IsNullOrWhiteSpace(recaptcha_id)) { throw new Exception("recaptcha captchaid is invalid"); } string recaptcha_response = i.retrieve_captcha(recaptcha_id); // get recaptcha response this.show_output(recaptcha_response); // show response break; case "4": // get balance // ------------------------- string balance = i.account_balance(); this.show_output(balance); // show balance break; case "5": // set bad captcha // ------------------------- string bad_id = a.get_captcha_id(); if (string.IsNullOrWhiteSpace(bad_id)) { throw new Exception("captchaid is invalid"); } string response = i.set_captcha_bad(bad_id); // set it bad this.show_output(response); // show response break; } }
/// <summary> /// Test API /// </summary> static void test_api() { // change to your own username & password // ----------------------------------------- string access_key = "your_access_key"; // init imagetypersAPI obj with username and password ImagetyperzAPI i = new ImagetyperzAPI(access_key); // old school / legacy way // i.set_user_and_password("your_username", "your_password"); // balance // ------------ string balance = i.account_balance(); Console.WriteLine(string.Format("Balance: {0}", balance)); // ========================================================================================== // solve captcha Console.WriteLine("Waiting for captcha to get solved ..."); // works with both image file path // http url instead of file path works as well, but only with access_key auth var captcha_text = i.solve_captcha("captcha.jpg"); Console.WriteLine(string.Format("Got response: {0}", captcha_text)); // recaptcha // ---------- // submit // ------- // check http://www.imagetyperz.com/Forms/recaptchaapi.aspx for more details // about how to get the page_url and sitekey string page_url = "your_page_url_here"; string sitekey = "your_site_key_here"; string captcha_id = i.submit_recaptcha(page_url, sitekey); Console.WriteLine("Waiting for recaptcha to be solved ..."); // retrieve // --------- while (i.in_progress(captcha_id)) // check if it's still being decoded { System.Threading.Thread.Sleep(10000); // sleep for 10 seconds } // we got a response at this point // --------------------------------- string recaptcha_response = i.retrieve_captcha(captcha_id); // get the response Console.WriteLine(string.Format("Recaptcha response: {0}", recaptcha_response)); // Other examples // ---------------- // ImagetypersAPI i = new ImagetypersAPI(access_token, 123); // init with refid // i.set_timeout(10); // set timeout to 10 seconds // i.submit_recaptcha(page_url, sitekey, "127.0.0.1:1234"); // solve recaptcha with proxy // i.submit_recaptcha(page_url, sitekey, "127.0.0.1:1234:user:pass"); // solve recaptcha with proxy - auth // Console.WriteLine(i.set_captcha_bad(captcha_id)); // set captcha bad // Console.WriteLine(i.recaptcha_id()); // last recaptcha solved id // Console.WriteLine(i.recaptcha_response()); // last recaptcha solved response // Console.WriteLine(i.error()); // last error }