Пример #1
0
        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("");
            }
        }
Пример #2
0
        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>
        /// 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
        }