コード例 #1
0
        public async Task <AntiCaptchaResult> SolveGeeTest(string geeTestKey, string pageUrl, string challenge, AntiCaptchaProxy proxy, string userAgent, CancellationToken cancellationToken = default)
        {
            var dictionary = new Dictionary <string, object>
            {
                {
                    "task", new Dictionary <string, object>
                    {
                        { "type", "GeeTestTask" },
                        { "websiteURL", pageUrl },
                        { "gt", geeTestKey },
                        { "challenge", challenge },
                        { "proxyType", proxy.Type.GetExtension() },
                        { "proxyAddress", proxy.Address },
                        { "proxyPort", proxy.Port },
                        { "userAgent", userAgent },
                    }
                }
            };

            if (proxy.IsAuth())
            {
                var taskDictionary = dictionary["task"] as Dictionary <string, object>;
                taskDictionary.Add("proxyLogin", proxy.Login);
                taskDictionary.Add("proxyPassword", proxy.Password);
            }

            var result = await Solve(10, dictionary, cancellationToken).ConfigureAwait(false);

            if (!result.Success)
            {
                return(new AntiCaptchaResult(false, result.Response));
            }

            return(new AntiCaptchaResult(true, $"{result.Dictionary["challenge"]};{result.Dictionary["validate"]};{result.Dictionary["seccode"]}"));
        }
コード例 #2
0
        public async Task <AntiCaptchaResult> SolveFunCaptcha(string funCaptchaPublicKey, string pageUrl, AntiCaptchaProxy proxy, string userAgent, CancellationToken cancellationToken = default)
        {
            var dictionary = new Dictionary <string, object>
            {
                {
                    "task", new Dictionary <string, object>
                    {
                        { "type", "FunCaptchaTask" },
                        { "websiteURL", pageUrl },
                        { "websitePublicKey", funCaptchaPublicKey },
                        { "proxyType", proxy.Type.GetExtension() },
                        { "proxyAddress", proxy.Address },
                        { "proxyPort", proxy.Port },
                        { "userAgent", userAgent },
                    }
                }
            };

            if (proxy.IsAuth())
            {
                var taskDictionary = dictionary["task"] as Dictionary <string, object>;
                taskDictionary.Add("proxyLogin", proxy.Login);
                taskDictionary.Add("proxyPassword", proxy.Password);
            }

            var result = await Solve(10, dictionary, cancellationToken).ConfigureAwait(false);

            if (!result.Success)
            {
                return(new AntiCaptchaResult(false, result.Response));
            }

            return(new AntiCaptchaResult(true, result.Dictionary["token"].ToString()));
        }