예제 #1
0
        static void Main(string[] args)
        {
            //Thread thread = new Thread(Method);
            //thread.Start();
            //Thread thread2 = new Thread(Method);
            //thread2.Start();
            //Thread thread3 = new Thread(Method);
            //thread3.Start();
            //Thread thread5 = new Thread(Method);
            //thread5.Start();
            //Thread thread4 = new Thread(Method);
            //thread4.Start();


            const string    API_KEY    = "1281f43cd9caa77cf65ff89fc95d6961";
            RuCaptchaClient client     = new RuCaptchaClient(API_KEY);
            string          captcha_id = client.UploadCaptchaFile(@"C:\Kahovsky\Pictures\XAzTmeRYtAo.jpg");
            string          answer     = null;

            while (string.IsNullOrEmpty(answer))
            {
                Thread.Sleep(2500);
                try
                {
                    answer = client.GetCaptcha(captcha_id);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
예제 #2
0
        private static string solveCaptcha(string url)
        {
            string solvedStr = string.Empty;
            string fileName  = new Random().Next(0, 155).ToString() + ".png";

            using (var webClient = new WebClient())
            {
                webClient.DownloadFile(url, $"tmp\\{fileName}");
            }
            string          api_key         = File.ReadAllText("key.txt");
            RuCaptchaClient ruCaptchaClient = new RuCaptchaClient(api_key);
            var             captchaID       = string.Empty;

            try
            {
                captchaID = ruCaptchaClient.UploadCaptchaFile($"tmp\\{fileName}");
            }
            catch { }
            while (string.IsNullOrEmpty(solvedStr))
            {
                try
                {
                    solvedStr = ruCaptchaClient.GetCaptcha(captchaID);
                }
                catch { }
                Thread.Sleep(1000);
            }
            File.Delete($"tmp\\{fileName}");
            return(solvedStr);
        }
예제 #3
0
        public static void Method()
        {
            const string    API_KEY    = "1281f43cd9caa77cf65ff89fc95d6961";
            RuCaptchaClient client     = new RuCaptchaClient(API_KEY);
            string          captcha_id = client.UploadCaptchaFile(@"C:\Kahovsky\Pictures\XAzTmeRYtAo.jpg");
            string          answer     = null;

            while (string.IsNullOrEmpty(answer))
            {
                Thread.Sleep(1000);
                try
                {
                    answer = client.GetCaptcha(captcha_id);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }